blob: 18b8e2bc3d938e3577c5e75f7f8435ebdf75b977 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
This file is part of jellything (https://codeberg.org/metamuffin/jellything)
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
use std::ops::Deref;
#[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()
}
}
impl<T> Deref for SortAnyway<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.0
}
}
|