From 45b6bb4e7c5d5772309822f76c40061e4266ed92 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 6 Oct 2023 17:37:21 +0200 Subject: [PATCH] Make `PartialOrd` implementations match `Ord` Clippy starts detecting this in Rust 1.73.0. --- crates/fj-core/src/geometry/boundary/single.rs | 2 +- crates/fj-core/src/storage/handle.rs | 2 +- crates/fj-math/src/scalar.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-core/src/geometry/boundary/single.rs b/crates/fj-core/src/geometry/boundary/single.rs index bd11aa384..bb87b509e 100644 --- a/crates/fj-core/src/geometry/boundary/single.rs +++ b/crates/fj-core/src/geometry/boundary/single.rs @@ -158,7 +158,7 @@ impl Ord for CurveBoundary { impl PartialOrd for CurveBoundary { fn partial_cmp(&self, other: &Self) -> Option { - self.inner.partial_cmp(&other.inner) + Some(self.cmp(other)) } } diff --git a/crates/fj-core/src/storage/handle.rs b/crates/fj-core/src/storage/handle.rs index 63eea2908..cbcc85aab 100644 --- a/crates/fj-core/src/storage/handle.rs +++ b/crates/fj-core/src/storage/handle.rs @@ -245,7 +245,7 @@ impl Ord for HandleWrapper { impl PartialOrd for HandleWrapper { fn partial_cmp(&self, other: &Self) -> Option { - self.0.id().partial_cmp(&other.0.id()) + Some(self.cmp(other)) } } diff --git a/crates/fj-math/src/scalar.rs b/crates/fj-math/src/scalar.rs index 88fc2ba99..90d7a1a9d 100644 --- a/crates/fj-math/src/scalar.rs +++ b/crates/fj-math/src/scalar.rs @@ -160,7 +160,7 @@ impl Eq for Scalar {} impl PartialOrd for Scalar { fn partial_cmp(&self, other: &Self) -> Option { - self.0.partial_cmp(&other.0) + Some(self.cmp(other)) } } @@ -168,7 +168,7 @@ impl Ord for Scalar { fn cmp(&self, other: &Self) -> cmp::Ordering { // Should never panic, as `from_f64` checks that the wrapped value is // finite. - self.partial_cmp(other).expect("Invalid `Scalar`") + self.0.partial_cmp(&other.0).expect("Invalid `Scalar`") } }