Skip to content

Commit

Permalink
Fix clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanoka committed Jun 19, 2023
1 parent 3bb4f50 commit 027749f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions geo/src/algorithm/monotone/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl<T: GeoNum> Builder<T> {
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}");
Expand Down Expand Up @@ -197,6 +198,7 @@ impl<T: GeoNum> Builder<T> {
// 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}");
Expand Down
14 changes: 6 additions & 8 deletions geo/src/algorithm/monotone/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<T: GeoNum, P: Debug + Clone> SimpleSweep<T, P> {

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 {
Expand All @@ -111,13 +111,11 @@ impl<T: GeoNum, P: Debug + Clone> SimpleSweep<T, P> {
} 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 {
Expand Down Expand Up @@ -156,7 +154,7 @@ impl<T: GeoNum, P: Debug + Clone> SimpleSweep<T, P> {
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() {
Expand Down

0 comments on commit 027749f

Please sign in to comment.