diff --git a/store/src/local/mutation_tracker.rs b/store/src/local/mutation_tracker.rs index 313b34b57..bc8c22ba0 100644 --- a/store/src/local/mutation_tracker.rs +++ b/store/src/local/mutation_tracker.rs @@ -63,10 +63,7 @@ impl MutationTracker { ); for operation_id in operation_ids { - let entry = inner - .operations_requests - .entry(operation_id) - .or_default(); + let entry = inner.operations_requests.entry(operation_id).or_default(); entry.insert(request_id); } } diff --git a/store/src/local/top_results.rs b/store/src/local/top_results.rs index 3eb762bf2..8516b86a5 100644 --- a/store/src/local/top_results.rs +++ b/store/src/local/top_results.rs @@ -78,7 +78,7 @@ struct ReserveItem { impl PartialOrd for ReserveItem { fn partial_cmp(&self, other: &Self) -> Option { - self.penalized_score.partial_cmp(&other.penalized_score) + Some(self.penalized_score.cmp(&other.penalized_score)) } } diff --git a/store/src/ordering.rs b/store/src/ordering.rs index 5ecd673cf..ae9c0c794 100644 --- a/store/src/ordering.rs +++ b/store/src/ordering.rs @@ -19,32 +19,35 @@ pub struct OrderingValueWrapper { impl PartialOrd for OrderingValueWrapper { fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for OrderingValueWrapper { + fn cmp(&self, other: &Self) -> Ordering { // an ignored result should be always be less, unless they are both if self.ignore && other.ignore { - return Some(std::cmp::Ordering::Equal); + return std::cmp::Ordering::Equal; } else if self.ignore { - return Some(std::cmp::Ordering::Less); + return std::cmp::Ordering::Less; } else if other.ignore { - return Some(std::cmp::Ordering::Greater); + return std::cmp::Ordering::Greater; } - let cmp = self.value.partial_cmp(&other.value); + let cmp = self + .value + .partial_cmp(&other.value) + .expect("expected value to be comparable"); // reverse if needed if self.reverse { - cmp.map(|o| o.reverse()) + cmp.reverse() } else { cmp } } } -impl Ord for OrderingValueWrapper { - fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).unwrap() - } -} - impl Eq for OrderingValueWrapper {} impl OrderingValueWrapper {