diff --git a/crates/typst/src/geom/scalar.rs b/crates/typst/src/geom/scalar.rs index 3fbf03ba7..45e00f5c8 100644 --- a/crates/typst/src/geom/scalar.rs +++ b/crates/typst/src/geom/scalar.rs @@ -84,29 +84,13 @@ impl PartialEq for Scalar { impl Ord for Scalar { fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).expect("float is NaN") + self.0.partial_cmp(&other.0).expect("float is NaN") } } impl PartialOrd for Scalar { fn partial_cmp(&self, other: &Self) -> Option { - self.0.partial_cmp(&other.0) - } - - fn lt(&self, other: &Self) -> bool { - self.0 < other.0 - } - - fn le(&self, other: &Self) -> bool { - self.0 <= other.0 - } - - fn gt(&self, other: &Self) -> bool { - self.0 > other.0 - } - - fn ge(&self, other: &Self) -> bool { - self.0 >= other.0 + Some(self.cmp(other)) } } diff --git a/crates/typst/src/geom/smart.rs b/crates/typst/src/geom/smart.rs index 6f6dcb491..bbd9b52a8 100644 --- a/crates/typst/src/geom/smart.rs +++ b/crates/typst/src/geom/smart.rs @@ -105,6 +105,8 @@ impl Smart { where T: Default, { + // we want to do this; the Clippy lint is not type-aware + #[allow(clippy::unwrap_or_default)] self.unwrap_or_else(T::default) } } diff --git a/crates/typst/src/geom/stroke.rs b/crates/typst/src/geom/stroke.rs index 1896bbf21..2b1bb8764 100644 --- a/crates/typst/src/geom/stroke.rs +++ b/crates/typst/src/geom/stroke.rs @@ -141,6 +141,8 @@ impl Stroke { /// Unpack the stroke, filling missing fields with the default values. pub fn unwrap_or_default(self) -> FixedStroke { + // we want to do this; the Clippy lint is not type-aware + #[allow(clippy::unwrap_or_default)] self.unwrap_or(FixedStroke::default()) } }