diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-10 16:26:10 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-13 03:46:03 +1100 |
| commit | e965ba85ca689ad77f63b7f0af9d7e337dcb4825 (patch) | |
| tree | 0ecf2223970c18455595e523ca594fe6d3321129 /src/libcoretest/num | |
| parent | 891559e30d045606aa109f4991074f783a5e50f8 (diff) | |
| download | rust-e965ba85ca689ad77f63b7f0af9d7e337dcb4825.tar.gz rust-e965ba85ca689ad77f63b7f0af9d7e337dcb4825.zip | |
Remove lots of numeric traits from the preludes
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
Diffstat (limited to 'src/libcoretest/num')
| -rw-r--r-- | src/libcoretest/num/int_macros.rs | 1 | ||||
| -rw-r--r-- | src/libcoretest/num/mod.rs | 12 | ||||
| -rw-r--r-- | src/libcoretest/num/uint_macros.rs | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index 51af2e2916d..a1b096bf454 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -15,6 +15,7 @@ macro_rules! int_module (($T:ty, $T_i:ident) => ( mod tests { use core::$T_i::*; use core::int; + use core::num::Int; use num; #[test] diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 51a44ef4d59..38502321c1d 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -8,7 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::num::cast; +use core::cmp::PartialEq; +use core::fmt::Show; +use core::num::{NumCast, cast}; +use core::ops::{Add, Sub, Mul, Div, Rem}; mod int_macros; mod i8; @@ -24,7 +27,12 @@ mod u64; mod uint; /// Helper function for testing numeric operations -pub fn test_num<T: Int + ::std::fmt::Show>(ten: T, two: T) { +pub fn test_num<T>(ten: T, two: T) where + T: PartialEq + NumCast + + Add<T, T> + Sub<T, T> + + Mul<T, T> + Div<T, T> + + Rem<T, T> + Show +{ assert_eq!(ten.add(&two), cast(12i).unwrap()); assert_eq!(ten.sub(&two), cast(8i).unwrap()); assert_eq!(ten.mul(&two), cast(20i).unwrap()); diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs index 1d3f1718d72..01a88119b64 100644 --- a/src/libcoretest/num/uint_macros.rs +++ b/src/libcoretest/num/uint_macros.rs @@ -14,6 +14,7 @@ macro_rules! uint_module (($T:ty, $T_i:ident) => ( #[cfg(test)] mod tests { use core::$T_i::*; + use core::num::Int; use num; #[test] |
