diff --git a/src/lib.rs b/src/lib.rs index 0cb9fe4..7df9b71 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,7 +75,7 @@ fn canonicalize_signed_zero(x: T) -> T { /// s.insert(OrderedFloat(NAN)); /// assert!(s.contains(&OrderedFloat(NAN))); /// ``` -#[derive(Debug, Default, Clone, Copy)] +#[derive(Default, Clone, Copy)] #[repr(transparent)] pub struct OrderedFloat(pub T); @@ -193,6 +193,13 @@ impl Hash for OrderedFloat { } } +impl fmt::Debug for OrderedFloat { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.0.fmt(f) + } +} + impl fmt::Display for OrderedFloat { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -1090,7 +1097,7 @@ impl Num for OrderedFloat { /// // This will panic: /// let c = a + b; /// ``` -#[derive(PartialOrd, PartialEq, Debug, Default, Clone, Copy)] +#[derive(PartialOrd, PartialEq, Default, Clone, Copy)] #[repr(transparent)] pub struct NotNan(T); @@ -1177,6 +1184,13 @@ impl Hash for NotNan { } } +impl fmt::Debug for NotNan { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.0.fmt(f) + } +} + impl fmt::Display for NotNan { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {