Skip to content

Commit bedbbb2

Browse files
committed
fix ci failure
Signed-off-by: tison <wander4096@gmail.com>
1 parent 8bf4676 commit bedbbb2

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ impl<T: FloatCore + Num> Num for OrderedFloat<T> {
12431243
not(feature = "bytemuck"),
12441244
doc = "[`bytemuck`]: https://docs.rs/bytemuck/1/"
12451245
)]
1246-
#[derive(PartialOrd, PartialEq, Default, Clone, Copy)]
1246+
#[derive(PartialEq, Default, Clone, Copy)]
12471247
#[repr(transparent)]
12481248
pub struct NotNan<T>(T);
12491249

@@ -1312,12 +1312,20 @@ impl Borrow<f64> for NotNan<f64> {
13121312
}
13131313
}
13141314

1315-
#[allow(clippy::derive_ord_xor_partial_ord)]
1315+
impl<T: FloatCore> PartialOrd for NotNan<T> {
1316+
#[inline]
1317+
fn partial_cmp(&self, other: &NotNan<T>) -> Option<Ordering> {
1318+
Some(self.cmp(other))
1319+
}
1320+
}
1321+
13161322
impl<T: FloatCore> Ord for NotNan<T> {
1323+
#[inline]
13171324
fn cmp(&self, other: &NotNan<T>) -> Ordering {
13181325
// Can't use unreachable_unchecked because unsafe code can't depend on FloatCore impl.
13191326
// https://github.com/reem/rust-ordered-float/issues/150
1320-
self.partial_cmp(other)
1327+
self.0
1328+
.partial_cmp(&other.0)
13211329
.expect("partial_cmp failed for non-NaN value")
13221330
}
13231331
}

0 commit comments

Comments
 (0)