mirror of https://codeberg.org/topola/topola.git
chore(math/polygon_tangents): Fix clippy warnings
This commit is contained in:
parent
42cf8f3a69
commit
c41627b023
|
|
@ -24,19 +24,14 @@ fn breadth4level(bounds: Range<usize>, level: u8, mut callback: impl FnMut(Range
|
||||||
callback(block_start..bounds.end);
|
callback(block_start..bounds.end);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, Default)]
|
||||||
enum TriState<T> {
|
enum TriState<T> {
|
||||||
|
#[default]
|
||||||
Nothing,
|
Nothing,
|
||||||
Got(T),
|
Got(T),
|
||||||
Fixed(T),
|
Fixed(T),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Default for TriState<T> {
|
|
||||||
fn default() -> Self {
|
|
||||||
TriState::Nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> TriState<T> {
|
impl<T> TriState<T> {
|
||||||
fn update(&mut self, value: T) -> bool {
|
fn update(&mut self, value: T) -> bool {
|
||||||
match self {
|
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<EF>(
|
fn cbps_brute_force<EF>(
|
||||||
bounds: core::ops::Range<usize>,
|
bounds: core::ops::Range<usize>,
|
||||||
eval: &EF,
|
eval: &EF,
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ impl<I: Copy + Eq> CachedPolyExt<I> {
|
||||||
debug_assert!(!poly_ext.is_empty());
|
debug_assert!(!poly_ext.is_empty());
|
||||||
|
|
||||||
let (pos_false, pos_true) =
|
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 prev = &poly_ext[(poly_ext.len() + i - 1) % poly_ext.len()];
|
||||||
let cur = &poly_ext[i];
|
let cur = &poly_ext[i];
|
||||||
let next = &poly_ext[(i + 1) % poly_ext.len()];
|
let next = &poly_ext[(i + 1) % poly_ext.len()];
|
||||||
|
|
@ -103,7 +103,7 @@ pub fn poly_ext_tangent_points<I: Copy>(
|
||||||
return Err(PolyTangentException::EmptyTargetPolygon { origin });
|
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 prev = &poly_ext[(poly_ext.len() + i - 1) % poly_ext.len()];
|
||||||
let cur = &poly_ext[i];
|
let cur = &poly_ext[i];
|
||||||
let next = &poly_ext[(i + 1) % poly_ext.len()];
|
let next = &poly_ext[(i + 1) % poly_ext.len()];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue