diff --git a/traits/src/identities.rs b/traits/src/identities.rs index bc6c084..7ce4af5 100644 --- a/traits/src/identities.rs +++ b/traits/src/identities.rs @@ -53,7 +53,7 @@ zero_impl!(f64, 0.0f64); impl Zero for Wrapping where Wrapping: Add> { fn is_zero(&self) -> bool { - self.0 == T::zero() + self.0.is_zero() } fn zero() -> Self { Wrapping(T::zero()) diff --git a/traits/src/lib.rs b/traits/src/lib.rs index 16d8fde..b61edad 100644 --- a/traits/src/lib.rs +++ b/traits/src/lib.rs @@ -82,7 +82,7 @@ impl Num for Wrapping { type FromStrRadixErr = T::FromStrRadixErr; fn from_str_radix(str: &str, radix: u32) -> Result { - T::from_str_radix(str, radix).map(|x| Wrapping(x)) + T::from_str_radix(str, radix).map(Wrapping) } }