Remove stray float literal .0 suffixes in lieu of just ending with a point (#4233)

Remove the .0 suffix on floats in lieu of just ending with a point
This commit is contained in:
Keavon Chambers
2026-06-12 19:47:36 -07:00
committed by GitHub
parent 2b8ef42086
commit cde8dd78e6
23 changed files with 125 additions and 125 deletions

View File

@@ -228,10 +228,10 @@ pub fn text_width(text: &str, font_size: f64) -> f64 {
let typesetting = TypesettingConfig {
font_size,
line_height_ratio: 1.2,
character_spacing: 0.0,
character_spacing: 0.,
max_width: None,
max_height: None,
tilt: 0.0,
tilt: 0.,
align: TextAlign::AlignLeft,
};

View File

@@ -1215,7 +1215,7 @@ impl OverlayContextInternal {
fn snap_to_physical_pixel(&self, p: DVec2) -> DVec2 {
let s = self.viewport.scale();
if !s.is_finite() || s <= 0.0 {
if !s.is_finite() || s <= 0. {
return p.round();
}
(p * s).round() / s
@@ -1223,7 +1223,7 @@ impl OverlayContextInternal {
fn snap_to_physical_pixel_center(&self, p: DVec2) -> DVec2 {
let s = self.viewport.scale();
if !s.is_finite() || s <= 0.0 {
if !s.is_finite() || s <= 0. {
return p.round() - DVec2::splat(0.5);
}
self.snap_to_physical_pixel(p) - DVec2::splat(0.5 / s)

View File

@@ -17,7 +17,7 @@ impl Default for ViewportMessageHandler {
offset: Point { x: 0., y: 0. },
size: Point { x: 0., y: 0. },
},
scale: 1.0,
scale: 1.,
}
}
}
@@ -400,14 +400,14 @@ impl FromWithScale<Bounds> for PhysicalBounds {
impl Mul<f64> for Point {
type Output = Point;
fn mul(self, rhs: f64) -> Self::Output {
assert_ne!(rhs, 0.0, "Cannot multiply point by zero");
assert_ne!(rhs, 0., "Cannot multiply point by zero");
Point { x: self.x * rhs, y: self.y * rhs }
}
}
impl Div<f64> for Point {
type Output = Point;
fn div(self, rhs: f64) -> Self::Output {
assert_ne!(rhs, 0.0, "Cannot divide point by zero");
assert_ne!(rhs, 0., "Cannot divide point by zero");
Point { x: self.x / rhs, y: self.y / rhs }
}
}
@@ -426,16 +426,16 @@ impl Sub<f64> for Point {
impl Mul<Point> for Point {
type Output = Point;
fn mul(self, rhs: Point) -> Self::Output {
assert_ne!(rhs.x, 0.0, "Cannot multiply point by zero");
assert_ne!(rhs.y, 0.0, "Cannot multiply point by zero");
assert_ne!(rhs.x, 0., "Cannot multiply point by zero");
assert_ne!(rhs.y, 0., "Cannot multiply point by zero");
Point { x: self.x * rhs.x, y: self.y * rhs.y }
}
}
impl Div<Point> for Point {
type Output = Point;
fn div(self, rhs: Point) -> Self::Output {
assert_ne!(rhs.x, 0.0, "Cannot multiply point by zero");
assert_ne!(rhs.y, 0.0, "Cannot multiply point by zero");
assert_ne!(rhs.x, 0., "Cannot multiply point by zero");
assert_ne!(rhs.y, 0., "Cannot multiply point by zero");
Point { x: self.x / rhs.x, y: self.y / rhs.y }
}
}
@@ -455,7 +455,7 @@ impl Sub<Point> for Point {
impl Mul<f64> for Bounds {
type Output = Bounds;
fn mul(self, rhs: f64) -> Self::Output {
assert_ne!(rhs, 0.0, "Cannot multiply bounds by zero");
assert_ne!(rhs, 0., "Cannot multiply bounds by zero");
Bounds {
offset: self.offset * rhs,
size: self.size * rhs,
@@ -465,7 +465,7 @@ impl Mul<f64> for Bounds {
impl Div<f64> for Bounds {
type Output = Bounds;
fn div(self, rhs: f64) -> Self::Output {
assert_ne!(rhs, 0.0, "Cannot divide bounds by zero");
assert_ne!(rhs, 0., "Cannot divide bounds by zero");
Bounds {
offset: self.offset / rhs,
size: self.size / rhs,