diff options
Diffstat (limited to 'common/src/helpers.rs')
-rw-r--r-- | common/src/helpers.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/src/helpers.rs b/common/src/helpers.rs index 92595e0..54f5479 100644 --- a/common/src/helpers.rs +++ b/common/src/helpers.rs @@ -5,15 +5,21 @@ */ use std::ops::Deref; -#[derive(PartialEq, PartialOrd)] +#[derive(PartialEq)] pub struct SortAnyway<T>(pub T); impl<T: PartialEq> Eq for SortAnyway<T> { fn assert_receiver_is_total_eq(&self) {} } +#[allow(clippy::non_canonical_partial_ord_impl)] +impl<T: PartialOrd> PartialOrd for SortAnyway<T> { + fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { + self.0.partial_cmp(&other.0) + } +} impl<T: PartialOrd> Ord for SortAnyway<T> { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.partial_cmp(&other).unwrap() + self.partial_cmp(other).unwrap() } } |