diff --git a/eden/scm/lib/dag/src/bsearch.rs b/eden/scm/lib/dag/src/bsearch.rs index 253df6ac4826e..8bec6712a2a00 100644 --- a/eden/scm/lib/dag/src/bsearch.rs +++ b/eden/scm/lib/dag/src/bsearch.rs @@ -28,13 +28,13 @@ pub trait BinarySearchBy { /// one of the matches could be returned. If the value is not found then /// [`Result::Err`] is returned, containing the index where a matching /// element could be inserted while maintaining sorted order. - fn binary_search_by(&self, f: F) -> Result + fn bsearch_by(&self, f: F) -> Result where F: FnMut(&T) -> Ordering; } impl BinarySearchBy for VecDeque { - fn binary_search_by(&self, mut f: F) -> Result + fn bsearch_by(&self, mut f: F) -> Result where F: FnMut(&T) -> Ordering, { diff --git a/eden/scm/lib/dag/src/spanset.rs b/eden/scm/lib/dag/src/spanset.rs index ea100893efea4..166e5894158f7 100644 --- a/eden/scm/lib/dag/src/spanset.rs +++ b/eden/scm/lib/dag/src/spanset.rs @@ -223,10 +223,7 @@ impl SpanSet { /// Tests if a given [`Id`] or [`Span`] is covered by this set. pub fn contains(&self, value: impl Into) -> bool { let span = value.into(); - let idx = match self - .spans - .binary_search_by(|probe| span.low.cmp(&probe.low)) - { + let idx = match self.spans.bsearch_by(|probe| span.low.cmp(&probe.low)) { Ok(idx) => idx, Err(idx) => idx, }; @@ -467,10 +464,7 @@ impl SpanSet { /// This is not a general purpose API, but useful for internal logic /// like DAG descendant calculation. pub(crate) fn intersection_span_min(&self, rhs: Span) -> Option { - let i = match self - .spans - .binary_search_by(|probe| rhs.low.cmp(&probe.high)) - { + let i = match self.spans.bsearch_by(|probe| rhs.low.cmp(&probe.high)) { Ok(idx) => idx, Err(idx) => idx.max(1) - 1, };