From 45b6bb4e7c5d5772309822f76c40061e4266ed92 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 6 Oct 2023 17:37:21 +0200 Subject: [PATCH 1/4] 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`") } } From 5ad27562baf01a2e77d4117e574f67bf5e0ec079 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 6 Oct 2023 17:45:28 +0200 Subject: [PATCH 2/4] Silence Clippy warnings --- crates/fj-core/src/algorithms/transform/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/fj-core/src/algorithms/transform/mod.rs b/crates/fj-core/src/algorithms/transform/mod.rs index b13bc49d8..f9230d669 100644 --- a/crates/fj-core/src/algorithms/transform/mod.rs +++ b/crates/fj-core/src/algorithms/transform/mod.rs @@ -100,6 +100,9 @@ pub struct TransformCache(TypeMap); impl TransformCache { fn get(&mut self, key: &Handle) -> Option<&Handle> { + // Silencing Clippy warning due to false positive in Rust 1.73.0. See: + // https://github.com/rust-lang/rust-clippy/issues/11390#issuecomment-1750951533 + #[allow(clippy::unwrap_or_default)] let map = self .0 .entry::>>() @@ -109,6 +112,9 @@ impl TransformCache { } fn insert(&mut self, key: Handle, value: Handle) { + // Silencing Clippy warning due to false positive in Rust 1.73.0. See: + // https://github.com/rust-lang/rust-clippy/issues/11390#issuecomment-1750951533 + #[allow(clippy::unwrap_or_default)] let map = self .0 .entry::>>() From d7b805bdbf681e97c96d70f78f6dae5d9cb02bc9 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 6 Oct 2023 17:46:04 +0200 Subject: [PATCH 3/4] Fix Clippy warning --- crates/fj-viewer/src/viewer.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index 06a367592..ac330ee78 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -1,5 +1,4 @@ use fj_interop::model::Model; -use fj_math::Aabb; use tracing::warn; use crate::{ @@ -93,7 +92,7 @@ impl Viewer { .model .as_ref() .map(|shape| shape.aabb) - .unwrap_or_else(Aabb::default); + .unwrap_or_default(); self.camera.update_planes(&aabb); From 3c4e075e9b544b562d9a072bd2fbe62b736bea9f Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 6 Oct 2023 17:48:32 +0200 Subject: [PATCH 4/4] Upgrade to Rust 1.73.0 --- rust-toolchain.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 4a410ecac..edf53789e 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.72.1" +channel = "1.73.0" components = ["rustfmt", "clippy"] targets = [ "aarch64-apple-ios",