From 73a411d9021730b23c594147eef03afc8f947902 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 11 Nov 2022 16:56:12 +0100 Subject: [PATCH] Update builder method --- crates/fj-kernel/src/builder/vertex.rs | 20 ++++++++----------- .../fj-kernel/src/partial/objects/vertex.rs | 8 ++++---- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/crates/fj-kernel/src/builder/vertex.rs b/crates/fj-kernel/src/builder/vertex.rs index 3328dcd1a..879d5533f 100644 --- a/crates/fj-kernel/src/builder/vertex.rs +++ b/crates/fj-kernel/src/builder/vertex.rs @@ -43,11 +43,10 @@ pub trait GlobalVertexBuilder { ) -> Self; /// Update partial global vertex from the given surface and position on it - fn update_from_surface_and_position( - &mut self, + fn from_surface_and_position( surface: &Surface, position: impl Into>, - ) -> &mut Self; + ) -> Self; } impl GlobalVertexBuilder for PartialGlobalVertex { @@ -66,18 +65,15 @@ impl GlobalVertexBuilder for PartialGlobalVertex { let position_surface = path.point_from_path_coords(position); - let mut global_vertex = PartialGlobalVertex::default(); - global_vertex - .update_from_surface_and_position(&surface, position_surface); - global_vertex + Self::from_surface_and_position(&surface, position_surface) } - fn update_from_surface_and_position( - &mut self, + fn from_surface_and_position( surface: &Surface, position: impl Into>, - ) -> &mut Self { - self.position = Some(surface.point_from_surface_coords(position)); - self + ) -> Self { + PartialGlobalVertex { + position: Some(surface.point_from_surface_coords(position)), + } } } diff --git a/crates/fj-kernel/src/partial/objects/vertex.rs b/crates/fj-kernel/src/partial/objects/vertex.rs index 39a1fffc3..ce6ba3c7e 100644 --- a/crates/fj-kernel/src/partial/objects/vertex.rs +++ b/crates/fj-kernel/src/partial/objects/vertex.rs @@ -107,10 +107,10 @@ impl PartialSurfaceVertex { let global_form = self .global_form - .update_partial(|mut global_form| { - global_form - .update_from_surface_and_position(&surface, position); - global_form + .update_partial(|_| { + PartialGlobalVertex::from_surface_and_position( + &surface, position, + ) }) .into_full(objects)?;