diff options
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/mod.rs | 12 | ||||
| -rw-r--r-- | src/libstd/num/uint.rs | 31 |
2 files changed, 0 insertions, 43 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 478029b8561..28f0cfbce15 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -139,18 +139,6 @@ pub trait Signed: Num pub trait Unsigned: Num {} -/// Times trait -/// -/// ```rust -/// let ten = 10u; -/// let mut accum = 0; -/// ten.times(|| { accum += 1; }) -/// ``` -/// -pub trait Times { - fn times(&self, it: ||); -} - pub trait Integer: Num + Orderable + Div<Self,Self> diff --git a/src/libstd/num/uint.rs b/src/libstd/num/uint.rs index 3eeae6283b3..89914571ada 100644 --- a/src/libstd/num/uint.rs +++ b/src/libstd/num/uint.rs @@ -20,7 +20,6 @@ use num::{Bitwise, Bounded}; use num::{CheckedAdd, CheckedSub, CheckedMul}; use num::{CheckedDiv, Zero, One, strconv}; use num::{ToStrRadix, FromStrRadix}; -use num; use option::{Option, Some, None}; use str; use unstable::intrinsics; @@ -80,27 +79,6 @@ pub fn div_round(x: uint, y: uint) -> uint { /// pub fn div_floor(x: uint, y: uint) -> uint { return x / y; } -impl num::Times for uint { - #[inline] - /// - /// A convenience form for basic repetition. Given a uint `x`, - /// `x.times(|| { ... })` executes the given block x times. - /// - /// Equivalent to `for uint::range(0, x) |_| { ... }`. - /// - /// Not defined on all integer types to permit unambiguous - /// use with integer literals of inferred integer-type as - /// the self-value (eg. `100.times(|| { ... })`). - /// - fn times(&self, it: ||) { - let mut i = *self; - while i > 0 { - it(); - i -= 1; - } - } -} - /// Returns the smallest power of 2 greater than or equal to `n` #[inline] pub fn next_power_of_two(n: uint) -> uint { @@ -245,12 +223,3 @@ fn test_div() { assert!((div_ceil(3u, 4u) == 1u)); assert!((div_round(3u, 4u) == 1u)); } - -#[test] -pub fn test_times() { - use num::Times; - let ten = 10 as uint; - let mut accum = 0; - ten.times(|| { accum += 1; }); - assert!((accum == 10)); -} |
