Skip to content

Commit

Permalink
Merge pull request #348 from waywardmonkeys/remove-usage-of-legacy-nu…
Browse files Browse the repository at this point in the history
…meric-constants

Fix `clippy::legacy_numeric_constants` lints
  • Loading branch information
RickyDaMa authored Jul 8, 2024
2 parents bc069f4 + eb472e3 commit cf54bab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/fontinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/glyph/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand All @@ -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()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/kerning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit cf54bab

Please sign in to comment.