Minor changes for correctness
This commit is contained in:
parent
9b06d4a0bb
commit
b562c1ec39
|
@ -53,7 +53,7 @@ zero_impl!(f64, 0.0f64);
|
||||||
|
|
||||||
impl<T: Zero + PartialEq> Zero for Wrapping<T> where Wrapping<T>: Add<Output=Wrapping<T>> {
|
impl<T: Zero + PartialEq> Zero for Wrapping<T> where Wrapping<T>: Add<Output=Wrapping<T>> {
|
||||||
fn is_zero(&self) -> bool {
|
fn is_zero(&self) -> bool {
|
||||||
self.0 == T::zero()
|
self.0.is_zero()
|
||||||
}
|
}
|
||||||
fn zero() -> Self {
|
fn zero() -> Self {
|
||||||
Wrapping(T::zero())
|
Wrapping(T::zero())
|
||||||
|
|
|
@ -82,7 +82,7 @@ impl<T: Num> Num for Wrapping<T>
|
||||||
{
|
{
|
||||||
type FromStrRadixErr = T::FromStrRadixErr;
|
type FromStrRadixErr = T::FromStrRadixErr;
|
||||||
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue