Skip to content

Commit

Permalink
Fixes the new deny-by-default incorrect_partial_ord_impl_on_ord_type …
Browse files Browse the repository at this point in the history
…Clippy lint (#2131)
  • Loading branch information
adamreichold authored Jul 21, 2023
1 parent 820f126 commit 42acd33
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ impl Ord for BlankRange {
}
impl PartialOrd for BlankRange {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.blank_size().cmp(&other.blank_size()))
Some(self.cmp(other))
}
}
6 changes: 4 additions & 2 deletions src/query/more_like_this/more_like_this.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ impl Eq for ScoreTerm {}

impl PartialOrd for ScoreTerm {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.score.partial_cmp(&other.score)
Some(self.cmp(other))
}
}

impl Ord for ScoreTerm {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.partial_cmp(other).unwrap_or(std::cmp::Ordering::Equal)
self.score
.partial_cmp(&other.score)
.unwrap_or(std::cmp::Ordering::Equal)
}
}

Expand Down
2 changes: 1 addition & 1 deletion sstable/src/merge/heap_merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<B: AsRef<[u8]>> Ord for HeapItem<B> {
}
impl<B: AsRef<[u8]>> PartialOrd for HeapItem<B> {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(other.0.as_ref().cmp(self.0.as_ref()))
Some(self.cmp(other))
}
}

Expand Down

0 comments on commit 42acd33

Please sign in to comment.