From 42acd334f49d5ff7e4fe846b5c12198f24409b50 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Fri, 21 Jul 2023 04:36:17 +0200 Subject: [PATCH] Fixes the new deny-by-default incorrect_partial_ord_impl_on_ord_type Clippy lint (#2131) --- .../column_values/u128_based/compact_space/blank_range.rs | 2 +- src/query/more_like_this/more_like_this.rs | 6 ++++-- sstable/src/merge/heap_merge.rs | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/columnar/src/column_values/u128_based/compact_space/blank_range.rs b/columnar/src/column_values/u128_based/compact_space/blank_range.rs index a1f265f00..4d1ceefd5 100644 --- a/columnar/src/column_values/u128_based/compact_space/blank_range.rs +++ b/columnar/src/column_values/u128_based/compact_space/blank_range.rs @@ -38,6 +38,6 @@ impl Ord for BlankRange { } impl PartialOrd for BlankRange { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.blank_size().cmp(&other.blank_size())) + Some(self.cmp(other)) } } diff --git a/src/query/more_like_this/more_like_this.rs b/src/query/more_like_this/more_like_this.rs index ca86c70b1..4f94319f1 100644 --- a/src/query/more_like_this/more_like_this.rs +++ b/src/query/more_like_this/more_like_this.rs @@ -23,13 +23,15 @@ impl Eq for ScoreTerm {} impl PartialOrd for ScoreTerm { fn partial_cmp(&self, other: &Self) -> Option { - 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) } } diff --git a/sstable/src/merge/heap_merge.rs b/sstable/src/merge/heap_merge.rs index 39840b088..e1742f91c 100644 --- a/sstable/src/merge/heap_merge.rs +++ b/sstable/src/merge/heap_merge.rs @@ -15,7 +15,7 @@ impl> Ord for HeapItem { } impl> PartialOrd for HeapItem { fn partial_cmp(&self, other: &Self) -> Option { - Some(other.0.as_ref().cmp(self.0.as_ref())) + Some(self.cmp(other)) } }