From 4e3a450a241d5a0ef436d25e329a8efbd6a89afe Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Jul 2023 09:31:03 +0200 Subject: [PATCH 1/5] Mark `Insert::insert` as `#[must_use]` --- crates/fj-core/src/operations/insert.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fj-core/src/operations/insert.rs b/crates/fj-core/src/operations/insert.rs index 4cba47b4f0..8ae9ed1de4 100644 --- a/crates/fj-core/src/operations/insert.rs +++ b/crates/fj-core/src/operations/insert.rs @@ -21,6 +21,7 @@ pub trait Insert: Sized { type Inserted; /// Insert the object into its respective store + #[must_use] fn insert(self, services: &mut Services) -> Self::Inserted; } From db06c3cafe5e1536df41618260ad33598f10fe66 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Jul 2023 09:31:41 +0200 Subject: [PATCH 2/5] Mark join methods as `#[must_use]` --- crates/fj-core/src/operations/join/cycle.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index 1b591a8544..4b97e6e901 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -14,6 +14,7 @@ use crate::{ /// Join a [`Cycle`] to another pub trait JoinCycle { /// Create a cycle that is joined to the provided edges + #[must_use] fn add_joined_edges(&self, edges: Es, services: &mut Services) -> Self where Es: IntoIterator, Curve, [Point<1>; 2])>, @@ -48,6 +49,7 @@ pub trait JoinCycle { /// /// Maybe a custom trait that is implemented for `usize` and all range types /// would be the best solution. + #[must_use] fn join_to( &self, other: &Cycle, From 6f11c540b7b536cb87c5dd3c492636b889f0880b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Jul 2023 09:32:09 +0200 Subject: [PATCH 3/5] Mark `Merge::merge` as `#[must_use]` --- crates/fj-core/src/operations/merge.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fj-core/src/operations/merge.rs b/crates/fj-core/src/operations/merge.rs index 968a6b3c50..067a10c847 100644 --- a/crates/fj-core/src/operations/merge.rs +++ b/crates/fj-core/src/operations/merge.rs @@ -5,6 +5,7 @@ use super::UpdateSolid; /// Merge two [`Solid`]s pub trait Merge { /// Merge this solid with another + #[must_use] fn merge(&self, other: &Self) -> Self; } From fce6f724bb23005821f0ad0144805a5c25aea415 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Jul 2023 09:32:32 +0200 Subject: [PATCH 4/5] Mark `Reverse::reverse` as `#[must_use]` --- crates/fj-core/src/operations/reverse/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/fj-core/src/operations/reverse/mod.rs b/crates/fj-core/src/operations/reverse/mod.rs index bb99a3bd75..0453e21abd 100644 --- a/crates/fj-core/src/operations/reverse/mod.rs +++ b/crates/fj-core/src/operations/reverse/mod.rs @@ -8,5 +8,6 @@ mod face; /// Reverse the direction/orientation of an object pub trait Reverse { /// Reverse the direction/orientation of the object + #[must_use] fn reverse(&self, services: &mut Services) -> Self; } From d53c50bb4cd3cff7e0b1fa3299d320be802959af Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Jul 2023 09:33:57 +0200 Subject: [PATCH 5/5] Mark update methods as `#[must_use]` --- crates/fj-core/src/operations/update/cycle.rs | 3 +++ crates/fj-core/src/operations/update/edge.rs | 2 ++ crates/fj-core/src/operations/update/face.rs | 1 + crates/fj-core/src/operations/update/region.rs | 2 ++ crates/fj-core/src/operations/update/shell.rs | 3 +++ crates/fj-core/src/operations/update/sketch.rs | 1 + crates/fj-core/src/operations/update/solid.rs | 1 + 7 files changed, 13 insertions(+) diff --git a/crates/fj-core/src/operations/update/cycle.rs b/crates/fj-core/src/operations/update/cycle.rs index c2b47f4889..93682dd1ac 100644 --- a/crates/fj-core/src/operations/update/cycle.rs +++ b/crates/fj-core/src/operations/update/cycle.rs @@ -6,6 +6,7 @@ use crate::{ /// Update a [`Cycle`] pub trait UpdateCycle { /// Add half-edges to the cycle + #[must_use] fn add_half_edges( &self, half_edges: impl IntoIterator>, @@ -16,6 +17,7 @@ pub trait UpdateCycle { /// # Panics /// /// Panics, unless this operation replaces exactly one half-edge. + #[must_use] fn replace_half_edge( &self, original: &Handle, @@ -27,6 +29,7 @@ pub trait UpdateCycle { /// # Panics /// /// Panics, unless this operation updates exactly one half-edge. + #[must_use] fn update_nth_half_edge( &self, index: usize, diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index c1def62b4c..691327df39 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -6,9 +6,11 @@ use crate::{ /// Update a [`HalfEdge`] pub trait UpdateHalfEdge { /// Update the start vertex of the half-edge + #[must_use] fn replace_start_vertex(&self, start_vertex: Handle) -> Self; /// Update the global form of the half-edge + #[must_use] fn replace_global_form(&self, global_form: Handle) -> Self; } diff --git a/crates/fj-core/src/operations/update/face.rs b/crates/fj-core/src/operations/update/face.rs index 8bd5beaff4..9fcea93e4f 100644 --- a/crates/fj-core/src/operations/update/face.rs +++ b/crates/fj-core/src/operations/update/face.rs @@ -9,6 +9,7 @@ use crate::{ /// Update a [`Face`] pub trait UpdateFace { /// Replace the region of the face + #[must_use] fn update_region( &self, f: impl FnOnce(&Handle) -> Handle, diff --git a/crates/fj-core/src/operations/update/region.rs b/crates/fj-core/src/operations/update/region.rs index c98d53600c..7fe62e6f23 100644 --- a/crates/fj-core/src/operations/update/region.rs +++ b/crates/fj-core/src/operations/update/region.rs @@ -6,12 +6,14 @@ use crate::{ /// Update a [`Region`] pub trait UpdateRegion { /// Update the exterior of the region + #[must_use] fn update_exterior( &self, f: impl FnOnce(&Handle) -> Handle, ) -> Self; /// Add the provides interiors to the region + #[must_use] fn add_interiors( &self, interiors: impl IntoIterator>, diff --git a/crates/fj-core/src/operations/update/shell.rs b/crates/fj-core/src/operations/update/shell.rs index 8d52918058..0bb7e2679a 100644 --- a/crates/fj-core/src/operations/update/shell.rs +++ b/crates/fj-core/src/operations/update/shell.rs @@ -6,9 +6,11 @@ use crate::{ /// Update a [`Shell`] pub trait UpdateShell { /// Add faces to the shell + #[must_use] fn add_faces(&self, faces: impl IntoIterator>) -> Self; /// Update a face of the shell + #[must_use] fn replace_face( &self, original: &Handle, @@ -16,6 +18,7 @@ pub trait UpdateShell { ) -> Self; /// Remove a face from the shell + #[must_use] fn remove_face(&self, handle: &Handle) -> Self; } diff --git a/crates/fj-core/src/operations/update/sketch.rs b/crates/fj-core/src/operations/update/sketch.rs index 39783d2456..87739942a5 100644 --- a/crates/fj-core/src/operations/update/sketch.rs +++ b/crates/fj-core/src/operations/update/sketch.rs @@ -6,6 +6,7 @@ use crate::{ /// Update a [`Sketch`] pub trait UpdateSketch { /// Add a region to the sketch + #[must_use] fn add_region(&self, region: Handle) -> Self; } diff --git a/crates/fj-core/src/operations/update/solid.rs b/crates/fj-core/src/operations/update/solid.rs index db2979a916..a1460cb305 100644 --- a/crates/fj-core/src/operations/update/solid.rs +++ b/crates/fj-core/src/operations/update/solid.rs @@ -6,6 +6,7 @@ use crate::{ /// Update a [`Solid`] pub trait UpdateSolid { /// Add a shell to the solid + #[must_use] fn add_shells( &self, shells: impl IntoIterator>,