diff --git a/geo/src/algorithm/monotone/builder.rs b/geo/src/algorithm/monotone/builder.rs index 9151fc0f6..d402ff038 100644 --- a/geo/src/algorithm/monotone/builder.rs +++ b/geo/src/algorithm/monotone/builder.rs @@ -106,6 +106,7 @@ impl Builder { if !incoming.is_empty() { let n = incoming.len(); + #[allow(clippy::bool_to_int_with_if)] let start_idx = if bot_region { 1 } else { 0 }; let ub_idx = n - (n - start_idx) % 2; debug!("reducing incoming segments: {n} -> {start_idx}..{ub_idx}"); @@ -197,6 +198,7 @@ impl Builder { // region. This again reduces the outgoing list to atmost two segments. if !outgoing.is_empty() { let n = outgoing.len(); + #[allow(clippy::bool_to_int_with_if)] let start_idx = if bot_region { 1 } else { 0 }; let ub_idx = n - (n - start_idx) % 2; debug!("reducing outgoing segments: {n} -> {start_idx}..{ub_idx}"); diff --git a/geo/src/algorithm/monotone/sweep.rs b/geo/src/algorithm/monotone/sweep.rs index 4243d49ca..272626f76 100644 --- a/geo/src/algorithm/monotone/sweep.rs +++ b/geo/src/algorithm/monotone/sweep.rs @@ -102,7 +102,7 @@ impl SimpleSweep { match &event.ty { LineLeft => { - let mut idx = self.active_segments.index_not_of(&segment); + let mut idx = self.active_segments.index_not_of(segment); for is_next in [false, true] { let (active, split) = if !is_next { if idx > 0 { @@ -111,13 +111,11 @@ impl SimpleSweep { } else { continue; } + } else if idx < self.active_segments.len() { + let active = &self.active_segments[idx]; + (active, self.check_interior_intersection(active, segment)) } else { - if idx < self.active_segments.len() { - let active = &self.active_segments[idx]; - (active, self.check_interior_intersection(active, segment)) - } else { - continue; - } + continue; }; match split { @@ -156,7 +154,7 @@ impl SimpleSweep { self.active_segments.insert_at(idx, segment.clone()); } LineRight => { - let idx = self.active_segments.index_of(&segment); + let idx = self.active_segments.index_of(segment); self.active_segments.remove_at(idx); if idx > 0 && idx < self.active_segments.len() {