From b7d7fc3ea26cc8e960f1ab910e07ff9c70a13346 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 8 Sep 2023 11:04:26 +0200 Subject: [PATCH] Refactor to simplify --- crates/fj-core/src/algorithms/approx/curve/approx.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/fj-core/src/algorithms/approx/curve/approx.rs b/crates/fj-core/src/algorithms/approx/curve/approx.rs index eb4948909..6bbb008a4 100644 --- a/crates/fj-core/src/algorithms/approx/curve/approx.rs +++ b/crates/fj-core/src/algorithms/approx/curve/approx.rs @@ -38,13 +38,10 @@ impl CurveApprox { } } - match existing_segment { - Some(segment) => segment, - None => { - self.segments.push(new_segment.clone()); - new_segment - } - } + existing_segment.unwrap_or_else(|| { + self.segments.push(new_segment.clone()); + new_segment + }) } }