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/task | |
| 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/task')
| -rw-r--r-- | src/libstd/task/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index aff4bc12039..d0124407bd4 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -683,7 +683,7 @@ fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port let ch = ch.clone(); do spawn_unlinked { // Give middle task a chance to fail-but-not-kill-us. - for 16.times { task::yield(); } + do 16.times { task::yield(); } ch.send(()); // If killed first, grandparent hangs. } fail!(); // Shouldn't kill either (grand)parent or (grand)child. @@ -698,7 +698,7 @@ fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails do spawn_supervised { fail!(); } // Give child a chance to fail-but-not-kill-us. - for 16.times { task::yield(); } + do 16.times { task::yield(); } } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_spawn_unlinked_sup_fail_down() { @@ -760,7 +760,7 @@ fn test_spawn_failure_propagate_grandchild() { do spawn_supervised { do spawn_supervised { block_forever(); } } - for 16.times { task::yield(); } + do 16.times { task::yield(); } fail!(); } @@ -770,7 +770,7 @@ fn test_spawn_failure_propagate_secondborn() { do spawn_supervised { do spawn { block_forever(); } // linked } - for 16.times { task::yield(); } + do 16.times { task::yield(); } fail!(); } @@ -780,7 +780,7 @@ fn test_spawn_failure_propagate_nephew_or_niece() { do spawn { // linked do spawn_supervised { block_forever(); } } - for 16.times { task::yield(); } + do 16.times { task::yield(); } fail!(); } @@ -790,7 +790,7 @@ fn test_spawn_linked_sup_propagate_sibling() { do spawn { // linked do spawn { block_forever(); } // linked } - for 16.times { task::yield(); } + do 16.times { task::yield(); } fail!(); } @@ -970,7 +970,7 @@ fn test_spawn_sched_blocking() { // Testing that a task in one scheduler can block in foreign code // without affecting other schedulers - for 20u.times { + do 20u.times { let (start_po, start_ch) = stream(); let (fin_po, fin_ch) = stream(); @@ -1076,7 +1076,7 @@ fn test_unkillable() { // We want to do this after failing do spawn_unlinked { - for 10.times { yield() } + do 10.times { yield() } ch.send(()); } @@ -1111,7 +1111,7 @@ fn test_unkillable_nested() { // We want to do this after failing do spawn_unlinked || { - for 10.times { yield() } + do 10.times { yield() } ch.send(()); } |
