From 6f8f06f2611666ce17107e4b52aaac87beb6e642 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 11 Nov 2022 16:42:51 +0100 Subject: [PATCH] Change style of `infer_surface_form` --- crates/fj-kernel/src/builder/vertex.rs | 4 ++-- crates/fj-kernel/src/validate/cycle.rs | 3 ++- crates/fj-kernel/src/validate/edge.rs | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/fj-kernel/src/builder/vertex.rs b/crates/fj-kernel/src/builder/vertex.rs index fda3e8873..88028756e 100644 --- a/crates/fj-kernel/src/builder/vertex.rs +++ b/crates/fj-kernel/src/builder/vertex.rs @@ -11,11 +11,11 @@ use crate::{ /// Builder API for [`PartialVertex`] pub trait VertexBuilder { /// Remove the surface form of the partial vertex, inferring it on build - fn infer_surface_form(self) -> Self; + fn infer_surface_form(&mut self) -> &mut Self; } impl VertexBuilder for PartialVertex { - fn infer_surface_form(mut self) -> Self { + fn infer_surface_form(&mut self) -> &mut Self { self.surface_form = PartialSurfaceVertex::default().into(); self } diff --git a/crates/fj-kernel/src/validate/cycle.rs b/crates/fj-kernel/src/validate/cycle.rs index 45824c301..b30ddaa9a 100644 --- a/crates/fj-kernel/src/validate/cycle.rs +++ b/crates/fj-kernel/src/validate/cycle.rs @@ -95,7 +95,8 @@ mod tests { // Sever connection between the last and first half-edge in the // cycle. - let first_vertex = first_vertex.into_partial().infer_surface_form(); + let mut first_vertex = first_vertex.into_partial(); + first_vertex.infer_surface_form(); *first_half_edge = first_half_edge .clone() .with_back_vertex(first_vertex) diff --git a/crates/fj-kernel/src/validate/edge.rs b/crates/fj-kernel/src/validate/edge.rs index 9e2fdb744..0a294d415 100644 --- a/crates/fj-kernel/src/validate/edge.rs +++ b/crates/fj-kernel/src/validate/edge.rs @@ -308,10 +308,8 @@ mod tests { |vertex| -> anyhow::Result<_, ValidationError> { let mut vertex = vertex.to_partial(); vertex.position = Some([0.].into()); - Ok(vertex - .infer_surface_form() - .build(&objects)? - .insert(&objects)?) + vertex.infer_surface_form(); + Ok(vertex.build(&objects)?.insert(&objects)?) }, )?, valid.global_form().clone(),