From c41627b0233a1466574bf133fe376edbf455b847 Mon Sep 17 00:00:00 2001 From: Ellen Emilia Anna Zscheile Date: Fri, 30 May 2025 15:19:36 +0200 Subject: [PATCH] chore(math/polygon_tangents): Fix clippy warnings --- src/math/cyclic_search.rs | 11 +++-------- src/math/polygon_tangents.rs | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/math/cyclic_search.rs b/src/math/cyclic_search.rs index 02a4689..a687a5a 100644 --- a/src/math/cyclic_search.rs +++ b/src/math/cyclic_search.rs @@ -24,19 +24,14 @@ fn breadth4level(bounds: Range, level: u8, mut callback: impl FnMut(Range callback(block_start..bounds.end); } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, Default)] enum TriState { + #[default] Nothing, Got(T), Fixed(T), } -impl Default for TriState { - fn default() -> Self { - TriState::Nothing - } -} - impl TriState { fn update(&mut self, value: T) -> bool { match self { @@ -108,7 +103,7 @@ impl Discover { } } -/// A brute-force implementation of [`cyclic_breadth_binary_search`]. +/// A brute-force implementation of [`cyclic_breadth_partition_search`]. fn cbps_brute_force( bounds: core::ops::Range, eval: &EF, diff --git a/src/math/polygon_tangents.rs b/src/math/polygon_tangents.rs index 2ac604d..7d449e5 100644 --- a/src/math/polygon_tangents.rs +++ b/src/math/polygon_tangents.rs @@ -46,7 +46,7 @@ impl CachedPolyExt { debug_assert!(!poly_ext.is_empty()); let (pos_false, pos_true) = - cyclic_breadth_partition_search(0..poly_ext.len(), &|i: usize| { + cyclic_breadth_partition_search(0..poly_ext.len(), |i: usize| { let prev = &poly_ext[(poly_ext.len() + i - 1) % poly_ext.len()]; let cur = &poly_ext[i]; let next = &poly_ext[(i + 1) % poly_ext.len()]; @@ -103,7 +103,7 @@ pub fn poly_ext_tangent_points( return Err(PolyTangentException::EmptyTargetPolygon { origin }); } - let (pos_false, pos_true) = cyclic_breadth_partition_search(0..poly_ext.len(), &|i: usize| { + let (pos_false, pos_true) = cyclic_breadth_partition_search(0..poly_ext.len(), |i: usize| { let prev = &poly_ext[(poly_ext.len() + i - 1) % poly_ext.len()]; let cur = &poly_ext[i]; let next = &poly_ext[(i + 1) % poly_ext.len()];