From 187a943e18196e9f8bd8d81bad9fa6cbeb96d592 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 21 May 2024 21:45:12 +0200 Subject: [PATCH] Refactor to prepare for follow-on change --- crates/fj-core/src/validate/shell.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 863322b3c..3ad4bdee6 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -28,7 +28,9 @@ impl Validate for Shell { CurveGeometryMismatch::check(self, geometry, config) .map(Into::into), ); - ShellValidationError::check_half_edge_pairs(self, geometry, errors); + errors.extend(ShellValidationError::check_half_edge_pairs( + self, geometry, + )); ShellValidationError::check_half_edge_coincidence( self, geometry, config, errors, ); @@ -75,8 +77,7 @@ impl ShellValidationError { fn check_half_edge_pairs<'r>( shell: &'r Shell, geometry: &'r Geometry, - errors: &'r mut Vec, - ) { + ) -> impl Iterator + 'r { let mut unmatched_half_edges = BTreeMap::new(); for face in shell.faces() { @@ -113,12 +114,13 @@ impl ShellValidationError { } } - errors.extend(unmatched_half_edges.into_values().cloned().map( - |half_edge| { + unmatched_half_edges + .into_values() + .cloned() + .map(|half_edge| { Self::HalfEdgeHasNoSibling(HalfEdgeHasNoSibling { half_edge }) .into() - }, - )); + }) } /// Check that non-sibling half-edges are not coincident