diff options
| author | bors <bors@rust-lang.org> | 2014-01-29 20:06:36 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-29 20:06:36 -0800 |
| commit | 3cb72a3655cdbe1db7a3555ade0c909d541bf336 (patch) | |
| tree | 3026841f646fff3ba7ce4d8bc319f0ced7db5efa /src/libstd/num | |
| parent | 704f93ff5e8a8079af4a16fe984fb9f84b347d11 (diff) | |
| parent | 729060dbb95afd1d8562a6b3129555a173b81b0c (diff) | |
| download | rust-3cb72a3655cdbe1db7a3555ade0c909d541bf336.tar.gz rust-3cb72a3655cdbe1db7a3555ade0c909d541bf336.zip | |
auto merge of #11672 : bjz/rust/remove-times, r=brson
`Times::times` was always a second-class loop because it did not support the `break` and `continue` operations. Its playful appeal (which I liked) was then lost after `do` was disabled for closures. It's time to let this one go.
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)); -} |
