diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-08-02 02:17:20 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-08-03 03:00:42 -0400 |
| commit | b3ad685f7f0e7a9a747dbd5407c60160bd0a3c53 (patch) | |
| tree | 121dd5be3ae6aa5ca2eb32a2357f1047fb9d139b /src/libstd/num/uint_macros.rs | |
| parent | 2a7be1c9e4d5a50dab4f3f95c8f1d843a7d6f084 (diff) | |
| download | rust-b3ad685f7f0e7a9a747dbd5407c60160bd0a3c53.tar.gz rust-b3ad685f7f0e7a9a747dbd5407c60160bd0a3c53.zip | |
replace all remaining `for` with `foreach` or `do`
Diffstat (limited to 'src/libstd/num/uint_macros.rs')
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index aa01b871b9d..a2874c96703 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -654,27 +654,34 @@ mod tests { pub fn test_ranges() { let mut l = ~[]; - for range_rev(14,11) |i| { + do range_rev(14,11) |i| { l.push(i); - } - for range_step(20,26,2) |i| { + true + }; + do range_step(20,26,2) |i| { l.push(i); - } - for range_step(36,30,-2) |i| { + true + }; + do range_step(36,30,-2) |i| { l.push(i); - } - for range_step(max_value - 2, max_value, 2) |i| { + true + }; + do range_step(max_value - 2, max_value, 2) |i| { l.push(i); - } - for range_step(max_value - 3, max_value, 2) |i| { + true + }; + do range_step(max_value - 3, max_value, 2) |i| { l.push(i); - } - for range_step(min_value + 2, min_value, -2) |i| { + true + }; + do range_step(min_value + 2, min_value, -2) |i| { l.push(i); - } - for range_step(min_value + 3, min_value, -2) |i| { + true + }; + do range_step(min_value + 3, min_value, -2) |i| { l.push(i); - } + true + }; assert_eq!(l, ~[13,12,11, 20,22,24, @@ -685,28 +692,28 @@ mod tests { min_value+3,min_value+1]); // None of the `fail`s should execute. - for range_rev(0,0) |_i| { + do range_rev(0,0) |_i| { fail!("unreachable"); - } - for range_step(10,0,1) |_i| { + }; + do range_step(10,0,1) |_i| { fail!("unreachable"); - } - for range_step(0,1,-10) |_i| { + }; + do range_step(0,1,-10) |_i| { fail!("unreachable"); - } + }; } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_range_step_zero_step_up() { - for range_step(0,10,0) |_i| {} + do range_step(0,10,0) |_i| { true }; } #[test] #[should_fail] #[ignore(cfg(windows))] fn test_range_step_zero_step_down() { - for range_step(0,-10,0) |_i| {} + do range_step(0,-10,0) |_i| { true }; } } |
