Minor changes for correctness

This commit is contained in:
Yoan Lecoq 2017-04-21 18:47:42 +02:00
parent 9b06d4a0bb
commit b562c1ec39
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ zero_impl!(f64, 0.0f64);
impl<T: Zero + PartialEq> Zero for Wrapping<T> where Wrapping<T>: Add<Output=Wrapping<T>> {
fn is_zero(&self) -> bool {
self.0 == T::zero()
self.0.is_zero()
}
fn zero() -> Self {
Wrapping(T::zero())

View File

@ -82,7 +82,7 @@ impl<T: Num> Num for Wrapping<T>
{
type FromStrRadixErr = T::FromStrRadixErr;
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr> {
T::from_str_radix(str, radix).map(|x| Wrapping(x))
T::from_str_radix(str, radix).map(Wrapping)
}
}