Skip to content

Commit

Permalink
Precondition for cmp_asssuming_same_buffer is to check same_buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 20, 2023
1 parent a6ac138 commit bdd0645
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl<'a> PartialEq for Cursor<'a> {
impl<'a> PartialOrd for Cursor<'a> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
if same_buffer(*self, *other) {
Some(self.ptr.cmp(&other.ptr))
Some(cmp_assuming_same_buffer(*self, *other))
} else {
None
}
Expand All @@ -413,7 +413,6 @@ fn start_of_buffer(cursor: Cursor) -> *const Entry {
}
}

#[cfg(any(feature = "full", feature = "derive"))]
pub(crate) fn cmp_assuming_same_buffer(a: Cursor, b: Cursor) -> Ordering {
a.ptr.cmp(&b.ptr)
}
Expand Down

0 comments on commit bdd0645

Please sign in to comment.