From 3dc32934c0e239ab8b741ce55333dfeff1da17e2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 21 Jun 2024 21:33:26 +0200 Subject: [PATCH] Save unnecessary allocation --- crates/fj-core/src/algorithms/approx/half_edge.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/half_edge.rs b/crates/fj-core/src/algorithms/approx/half_edge.rs index 6d0a73ba4..2c8a07bcf 100644 --- a/crates/fj-core/src/algorithms/approx/half_edge.rs +++ b/crates/fj-core/src/algorithms/approx/half_edge.rs @@ -2,6 +2,8 @@ //! //! See [`HalfEdgeApprox`]. +use std::iter; + use crate::{ geometry::Geometry, storage::Handle, @@ -48,11 +50,8 @@ impl Approx for (&Handle, &Handle) { geometry, ); - let mut points = vec![start]; - points.extend(rest.points); - - let points = points - .into_iter() + let points = iter::once(start) + .chain(rest.points) .map(|point| { let point_surface = geometry .of_curve(half_edge.curve())