From 99017f82b6e41ed283199b88ddfc0990bb95d696 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 31 Dec 2014 15:45:13 -0500 Subject: use assoc types in binop traits --- src/libcore/num/mod.rs | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/libcore/num') diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index d16478dd6cc..c642ff0c2e4 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -35,7 +35,7 @@ use str::{FromStr, from_str, StrExt}; /// Simultaneous division and remainder #[inline] #[deprecated = "use division and remainder directly"] -pub fn div_rem + Rem>(x: T, y: T) -> (T, T) { +pub fn div_rem + Rem>(x: T, y: T) -> (T, T) { (x.clone() / y.clone(), x % y) } @@ -53,17 +53,17 @@ pub trait Int + NumCast + PartialOrd + Ord + PartialEq + Eq - + Add - + Sub - + Mul - + Div - + Rem + + Add + + Sub + + Mul + + Div + + Rem + Not - + BitAnd - + BitOr - + BitXor - + Shl - + Shr + + BitAnd + + BitOr + + BitXor + + Shl + + Shr { /// Returns the `0` value of this integer type. // FIXME (#5527): Should be an associated constant @@ -1246,11 +1246,11 @@ pub trait Float + PartialOrd + PartialEq + Neg - + Add - + Sub - + Mul - + Div - + Rem + + Add + + Sub + + Mul + + Div + + Rem { /// Returns the NaN value. fn nan() -> Self; @@ -1719,11 +1719,11 @@ macro_rules! trait_impl { #[allow(deprecated)] pub trait Num: PartialEq + Zero + One + Neg - + Add - + Sub - + Mul - + Div - + Rem {} + + Add + + Sub + + Mul + + Div + + Rem {} trait_impl! { Num for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } #[deprecated = "Generalised unsigned numbers are no longer supported"] @@ -1737,7 +1737,7 @@ pub trait Primitive: Copy + Clone + Num + NumCast + PartialOrd {} trait_impl! { Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 } #[deprecated = "The generic `Zero` trait will be removed soon."] -pub trait Zero: Add { +pub trait Zero: Add { #[deprecated = "Use `Int::zero()` or `Float::zero()`."] fn zero() -> Self; #[deprecated = "Use `x == Int::zero()` or `x == Float::zero()`."] @@ -1768,7 +1768,7 @@ zero_impl! { f32, 0.0f32 } zero_impl! { f64, 0.0f64 } #[deprecated = "The generic `One` trait will be removed soon."] -pub trait One: Mul { +pub trait One: Mul { #[deprecated = "Use `Int::one()` or `Float::one()`."] fn one() -> Self; } -- cgit 1.4.1-3-g733a5