Skip to content

Commit

Permalink
Merge pull request georust#1048 from RobWalt/chore/cleanup-remove-unu…
Browse files Browse the repository at this point in the history
…sed-code

chore: remove unused impl of private trait ActiveSet
  • Loading branch information
michaelkirk authored Aug 25, 2023
2 parents c4ee486 + f5181ba commit d13e70c
Showing 1 changed file with 1 addition and 45 deletions.
46 changes: 1 addition & 45 deletions geo/src/algorithm/sweep/active.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use std::{
borrow::Borrow,
cmp::Ordering,
collections::BTreeSet,
fmt::Debug,
ops::{Bound, Deref},
};
use std::{borrow::Borrow, cmp::Ordering, fmt::Debug, ops::Deref};

/// A segment currently active in the sweep.
///
Expand Down Expand Up @@ -86,41 +80,3 @@ pub(in crate::algorithm) trait ActiveSet: Default {
fn insert_active(&mut self, segment: Self::Seg);
fn remove_active(&mut self, segment: &Self::Seg);
}

impl<T: PartialOrd + Debug> ActiveSet for BTreeSet<Active<T>> {
type Seg = T;

fn previous_find<F: FnMut(&Active<Self::Seg>) -> bool>(
&self,
segment: &Self::Seg,
mut f: F,
) -> Option<&Active<Self::Seg>> {
self.range::<Active<_>, _>((
Bound::Unbounded,
Bound::Excluded(Active::active_ref(segment)),
))
.rev()
.find(|&a| f(a))
}
fn next_find<F: FnMut(&Active<Self::Seg>) -> bool>(
&self,
segment: &Self::Seg,
mut f: F,
) -> Option<&Active<Self::Seg>> {
self.range::<Active<_>, _>((
Bound::Excluded(Active::active_ref(segment)),
Bound::Unbounded,
))
.find(|&a| f(a))
}

fn insert_active(&mut self, segment: Self::Seg) {
let result = self.insert(Active(segment));
debug_assert!(result);
}

fn remove_active(&mut self, segment: &Self::Seg) {
let result = self.remove(Active::active_ref(segment));
debug_assert!(result);
}
}

0 comments on commit d13e70c

Please sign in to comment.