From 526610a4ed2c38c82d4e16ea750900cab02ffdc2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 23 Sep 2022 15:39:00 +0200 Subject: [PATCH] Consolidate redundant code --- crates/fj-kernel/src/partial/edge.rs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/crates/fj-kernel/src/partial/edge.rs b/crates/fj-kernel/src/partial/edge.rs index 1a872d834..30fc56d39 100644 --- a/crates/fj-kernel/src/partial/edge.rs +++ b/crates/fj-kernel/src/partial/edge.rs @@ -121,23 +121,20 @@ impl<'a> PartialHalfEdge<'a> { }; let vertices = { + // Can be cleaned up, once `zip` is stable: + // https://doc.rust-lang.org/std/primitive.array.html#method.zip let [a_global, b_global] = global_vertices; let [a_surface, b_surface] = surface_vertices; - - [ - Vertex::new( - Point::from([0.]), - curve.clone(), - a_surface, - a_global, - ), - Vertex::new( - Point::from([1.]), - curve.clone(), - b_surface, - b_global, - ), - ] + [(0., a_surface, a_global), (1., b_surface, b_global)].map( + |(position, surface_form, global_form)| { + Vertex::new( + [position], + curve.clone(), + surface_form, + global_form, + ) + }, + ) }; self.curve = Some(curve);