diff --git a/src/lib.rs b/src/lib.rs index baa067f..72f23d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,7 +15,6 @@ use core::cmp::Ordering; use core::convert::TryFrom; use core::fmt; use core::hash::{Hash, Hasher}; -use core::hint::unreachable_unchecked; use core::iter::{Product, Sum}; use core::num::FpCategory; use core::ops::{ @@ -1163,9 +1162,11 @@ impl Borrow for NotNan { #[allow(clippy::derive_ord_xor_partial_ord)] impl Ord for NotNan { fn cmp(&self, other: &NotNan) -> Ordering { + // Can't use unreachable_unchecked because unsafe code can't depend on FloatCore impl. + // https://github.com/reem/rust-ordered-float/issues/150 match self.partial_cmp(other) { Some(ord) => ord, - None => unsafe { unreachable_unchecked() }, + None => unreachable!(), } } }