From eb472e3edf83474460335273ae37295cef0846c1 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 8 Jul 2024 11:43:23 +0700 Subject: [PATCH] Fix `clippy::legacy_numeric_constants` lints --- src/fontinfo.rs | 2 +- src/glyph/serialize.rs | 4 ++-- src/kerning.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fontinfo.rs b/src/fontinfo.rs index cf8a2ed8..97b18058 100644 --- a/src/fontinfo.rs +++ b/src/fontinfo.rs @@ -1072,7 +1072,7 @@ impl NonNegativeIntegerOrFloat { /// Returns `true` if the value is an integer. pub(crate) fn is_integer(&self) -> bool { - self.0.fract().abs() < std::f64::EPSILON + self.0.fract().abs() < f64::EPSILON } } diff --git a/src/glyph/serialize.rs b/src/glyph/serialize.rs index d57e8a5f..74bdcc77 100644 --- a/src/glyph/serialize.rs +++ b/src/glyph/serialize.rs @@ -353,7 +353,7 @@ fn char_to_event(c: char) -> Event<'static> { } fn write_transform_attributes(element: &mut BytesStart, transform: &AffineTransform) { - if (transform.x_scale - 1.0).abs() > std::f64::EPSILON { + if (transform.x_scale - 1.0).abs() > f64::EPSILON { element.push_attribute(("xScale", transform.x_scale.to_string().as_str())); } @@ -365,7 +365,7 @@ fn write_transform_attributes(element: &mut BytesStart, transform: &AffineTransf element.push_attribute(("yxScale", transform.yx_scale.to_string().as_str())); } - if (transform.y_scale - 1.0).abs() > std::f64::EPSILON { + if (transform.y_scale - 1.0).abs() > f64::EPSILON { element.push_attribute(("yScale", transform.y_scale.to_string().as_str())); } diff --git a/src/kerning.rs b/src/kerning.rs index 8021e268..37fda512 100644 --- a/src/kerning.rs +++ b/src/kerning.rs @@ -48,7 +48,7 @@ impl<'a> Serialize for KerningInnerSerializer<'a> { { let mut map = serializer.serialize_map(Some(self.inner_kerning.len()))?; for (k, v) in self.inner_kerning { - if (v - v.round()).abs() < std::f64::EPSILON { + if (v - v.round()).abs() < f64::EPSILON { map.serialize_entry(k, &(*v as i32))?; } else { map.serialize_entry(k, v)?;