diff options
Diffstat (limited to 'src/geom')
| -rw-r--r-- | src/geom/rounded.rs | 4 | ||||
| -rw-r--r-- | src/geom/scalar.rs | 30 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/geom/rounded.rs b/src/geom/rounded.rs index 24b52448..f1a7ea08 100644 --- a/src/geom/rounded.rs +++ b/src/geom/rounded.rs @@ -1,7 +1,5 @@ use super::*; -use std::mem; - /// Produce shapes that together make up a rounded rectangle. pub fn rounded_rect( size: Size, @@ -69,7 +67,7 @@ fn stroke_segments( ); if !continuous { - res.push((mem::take(&mut path), stroke.get_ref(side).clone())); + res.push((std::mem::take(&mut path), stroke.get_ref(side).clone())); } } diff --git a/src/geom/scalar.rs b/src/geom/scalar.rs index b45ae60a..71fb1755 100644 --- a/src/geom/scalar.rs +++ b/src/geom/scalar.rs @@ -34,6 +34,21 @@ impl Debug for Scalar { } } +impl Eq for Scalar {} + +impl PartialEq for Scalar { + fn eq(&self, other: &Self) -> bool { + assert!(!self.0.is_nan() && !other.0.is_nan(), "float is NaN"); + self.0 == other.0 + } +} + +impl PartialEq<f64> for Scalar { + fn eq(&self, other: &f64) -> bool { + self == &Self(*other) + } +} + impl Ord for Scalar { fn cmp(&self, other: &Self) -> Ordering { self.partial_cmp(other).expect("float is NaN") @@ -62,21 +77,6 @@ impl PartialOrd for Scalar { } } -impl Eq for Scalar {} - -impl PartialEq for Scalar { - fn eq(&self, other: &Self) -> bool { - assert!(!self.0.is_nan() && !other.0.is_nan(), "float is NaN"); - self.0 == other.0 - } -} - -impl PartialEq<f64> for Scalar { - fn eq(&self, other: &f64) -> bool { - self == &Self(*other) - } -} - impl Hash for Scalar { fn hash<H: Hasher>(&self, state: &mut H) { debug_assert!(!self.0.is_nan(), "float is NaN"); |
