From 7680c9039001a7d2aa7bbbe3cb17d9a4903e8e30 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 13 Oct 2021 20:49:18 +0100 Subject: [PATCH] Clippy: Simplify Duplicated code block. --- .../algorithm/polygon_distance_fast_path.rs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/geo/src/algorithm/polygon_distance_fast_path.rs b/geo/src/algorithm/polygon_distance_fast_path.rs index 4da7141aa..d04fb9b65 100644 --- a/geo/src/algorithm/polygon_distance_fast_path.rs +++ b/geo/src/algorithm/polygon_distance_fast_path.rs @@ -369,10 +369,10 @@ where let perpunit = unitpvector(p, punit); let mut obtuse = false; let left = leftturn(p, perpunit, Point(pnext)); + if left == 0 { + obtuse = true; + } if clockwise { - if left == 0 { - obtuse = true; - } if left == -1 { angle = T::PI() / (T::one() + T::one()); } else if !obtuse { @@ -380,18 +380,14 @@ where } else { angle = T::PI() - (-sine).asin(); } + } else if left == -1 { + angle = T::PI() / (T::one() + T::one()); + } else if !obtuse { + angle = sine.asin(); } else { - if left == 0 { - obtuse = true; - } - if left == -1 { - angle = T::PI() / (T::one() + T::one()); - } else if !obtuse { - angle = sine.asin(); - } else { - angle = T::PI() - sine.asin(); - } + angle = T::PI() - sine.asin(); } + angle }