From b562c1ec39c3cd332804ed81ec6d4bdeb87599db Mon Sep 17 00:00:00 2001 From: Yoan Lecoq Date: Fri, 21 Apr 2017 18:47:42 +0200 Subject: [PATCH] Minor changes for correctness --- traits/src/identities.rs | 2 +- traits/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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) } }