diff options
| author | blake2-ppc <blake2-ppc> | 2013-08-01 04:18:19 +0200 |
|---|---|---|
| committer | blake2-ppc <blake2-ppc> | 2013-08-01 16:54:22 +0200 |
| commit | 78cde5b9fb9db91f954f7fe4afdd230de6754e54 (patch) | |
| tree | 524e26fcde0b5f86f453eac7768b4881d6f979fc /src/libstd/iterator.rs | |
| parent | 7e210a8129c844e0b3aca4a28153effd0817ef41 (diff) | |
| download | rust-78cde5b9fb9db91f954f7fe4afdd230de6754e54.tar.gz rust-78cde5b9fb9db91f954f7fe4afdd230de6754e54.zip | |
std: Change `Times` trait to use `do` instead of `for`
Change the former repetition::
for 5.times { }
to::
do 5.times { }
.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
Diffstat (limited to 'src/libstd/iterator.rs')
| -rw-r--r-- | src/libstd/iterator.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/iterator.rs b/src/libstd/iterator.rs index 84923876cbf..013901d57f8 100644 --- a/src/libstd/iterator.rs +++ b/src/libstd/iterator.rs @@ -18,7 +18,6 @@ implementing the `Iterator` trait. */ use cmp; -use iter::Times; use num::{Zero, One}; use option::{Option, Some, None}; use ops::{Add, Mul}; @@ -1229,8 +1228,9 @@ impl<A, T: Iterator<A>> Iterator<A> for Skip<T> { if self.n == 0 { next } else { - let n = self.n; - for n.times { + let mut n = self.n; + while n > 0 { + n -= 1; match next { Some(_) => { next = self.iter.next(); |
