From 65cf917fe5a18c94cbc583509c988f3275696b01 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 8 Mar 2022 17:07:55 +0100 Subject: [PATCH] Refactor --- src/kernel/shapes/difference_2d.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/kernel/shapes/difference_2d.rs b/src/kernel/shapes/difference_2d.rs index 32cfff804..007c4bb37 100644 --- a/src/kernel/shapes/difference_2d.rs +++ b/src/kernel/shapes/difference_2d.rs @@ -28,6 +28,14 @@ impl ToShape for fj::Difference2d { cycle in each operand." ); } + if shape.faces().all().count() != 1 { + // See issue: + // https://github.com/hannobraun/Fornjot/issues/95 + todo!( + "The 2-dimensional difference operation only supports one \ + face in each operand." + ); + } } // Can't panic, as we just verified that both shapes have one cycle. @@ -41,22 +49,11 @@ impl ToShape for fj::Difference2d { } { - let (a, b) = if a.faces().all().count() == 1 - && b.faces().all().count() == 1 - { - // Can't panic. We just checked that length of `a` and `b` is 1. - ( - a.faces().all().next().unwrap(), - b.faces().all().next().unwrap(), - ) - } else { - // See issue: - // https://github.com/hannobraun/Fornjot/issues/95 - todo!( - "The 2-dimensional difference operation only supports one \ - face in each operand." - ); - }; + // Can't panic, as we just verified that both shapes have one face. + let (a, b) = ( + a.faces().all().next().unwrap(), + b.faces().all().next().unwrap(), + ); let (a, b, surface_a, surface_b) = match ((*a).clone(), (*b).clone()) {