diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-01-26 15:44:22 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-01-29 07:46:44 -0500 |
| commit | c300d681bd2e901ef39591bbfb1ea4568ac6be70 (patch) | |
| tree | ee0b4b0a74846595b700d1b2375fd10309b63a22 /src/test | |
| parent | bedd8108dc9b79402d1ea5349d766275f73398ff (diff) | |
| download | rust-c300d681bd2e901ef39591bbfb1ea4568ac6be70.tar.gz rust-c300d681bd2e901ef39591bbfb1ea4568ac6be70.zip | |
`range(a, b).foo()` -> `(a..b).foo()`
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/core-map.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-fannkuch-redux.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-k-nucleotide.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-mandelbrot.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/shootout-meteor.rs | 4 | ||||
| -rw-r--r-- | src/test/bench/sudoku.rs | 4 | ||||
| -rw-r--r-- | src/test/debuginfo/lexical-scope-in-parameterless-closure.rs | 2 | ||||
| -rw-r--r-- | src/test/run-make/unicode-input/span_length.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/borrowck-mut-uniq.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/extern-stress.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/extern-yield.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-15673.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-18539.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/issue-2989.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/realloc-16687.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/running-with-no-runtime.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/tcp-accept-stress.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/typeck_type_placeholder_1.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/unique-send-2.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/wait-forked-but-failed-child.rs | 2 |
20 files changed, 29 insertions, 29 deletions
diff --git a/src/test/bench/core-map.rs b/src/test/bench/core-map.rs index cc7a0f2c768..663ee9b719f 100644 --- a/src/test/bench/core-map.rs +++ b/src/test/bench/core-map.rs @@ -62,13 +62,13 @@ fn descending<M: MutableMap>(map: &mut M, n_keys: uint) { println!(" Descending integers:"); timed("insert", || { - for i in range(0, n_keys).rev() { + for i in (0..n_keys).rev() { map.insert(i, i + 1); } }); timed("search", || { - for i in range(0, n_keys).rev() { + for i in (0..n_keys).rev() { assert_eq!(map.find(&i).unwrap(), &(i + 1)); } }); diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs index 5a0a4099389..ebdecbc8d02 100644 --- a/src/test/bench/shootout-fannkuch-redux.rs +++ b/src/test/bench/shootout-fannkuch-redux.rs @@ -97,7 +97,7 @@ impl Perm { *place = i as i32 + 1; } - for i in range(1, self.n as uint).rev() { + for i in (1..self.n as uint).rev() { let d = idx / self.fact[i] as i32; self.cnt[i] = d; idx %= self.fact[i] as i32; @@ -161,7 +161,7 @@ fn fannkuch(n: i32) -> (i32, i32) { let mut futures = vec![]; let k = perm.max() / N; - for (_, j) in range(0, N).zip(iter::count(0, k)) { + for (_, j) in (0..N).zip(iter::count(0, k)) { let max = cmp::min(j+k, perm.max()); futures.push(Thread::scoped(move|| { diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index 0d51eca8e8b..67654f979c2 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -135,7 +135,7 @@ struct Items<'a> { impl Table { fn new() -> Table { Table { - items: range(0, TABLE_SIZE).map(|_| None).collect() + items: (0..TABLE_SIZE).map(|_| None).collect() } } @@ -299,7 +299,7 @@ fn main() { }; let input = Arc::new(input); - let nb_freqs: Vec<_> = range(1u, 3).map(|i| { + let nb_freqs: Vec<_> = (1u..3).map(|i| { let input = input.clone(); (i, Thread::scoped(move|| generate_frequencies(input.as_slice(), i))) }).collect(); diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index 192f363599c..d0959068ce8 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -80,7 +80,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> { let mut precalc_r = Vec::with_capacity(w); let mut precalc_i = Vec::with_capacity(h); - let precalc_futures = range(0, WORKERS).map(|i| { + let precalc_futures = (0..WORKERS).map(|i| { Thread::scoped(move|| { let mut rs = Vec::with_capacity(w / WORKERS); let mut is = Vec::with_capacity(w / WORKERS); @@ -118,7 +118,7 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> { let arc_init_r = Arc::new(precalc_r); let arc_init_i = Arc::new(precalc_i); - let data = range(0, WORKERS).map(|i| { + let data = (0..WORKERS).map(|i| { let vec_init_r = arc_init_r.clone(); let vec_init_i = arc_init_i.clone(); diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs index 0480c9d884a..b31241f1215 100644 --- a/src/test/bench/shootout-meteor.rs +++ b/src/test/bench/shootout-meteor.rs @@ -169,7 +169,7 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > { .map(|(id, p)| transform(p, id != 3)) .collect(); - range(0i, 50).map(|yx| { + (0i..50).map(|yx| { transforms.iter().enumerate().map(|(id, t)| { t.iter().filter_map(|p| mask(yx / 5, yx % 5, id, p)).collect() }).collect() @@ -297,7 +297,7 @@ fn search( let masks_at = &masks[i]; // for every unused piece - for id in range(0u, 10).filter(|&id| board & (1 << (id + 50)) == 0) { + for id in (0u..10).filter(|&id| board & (1 << (id + 50)) == 0) { // for each mask that fits on the board for m in masks_at[id].iter().filter(|&m| board & *m == 0) { // This check is too costly. diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 30a0bd7bd91..8c6925a0f1f 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -49,8 +49,8 @@ impl Sudoku { } pub fn from_vec(vec: &[[u8;9];9]) -> Sudoku { - let g = range(0, 9u).map(|i| { - range(0, 9u).map(|j| { vec[i][j] }).collect() + let g = (0..9u).map(|i| { + (0..9u).map(|j| { vec[i][j] }).collect() }).collect(); return Sudoku::new(g) } diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index 0050b9273e8..107c5cb9782 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -19,6 +19,6 @@ // Nothing to do here really, just make sure it compiles. See issue #8513. fn main() { let _ = |&:|(); - let _ = range(1u,3).map(|_| 5i); + let _ = (1u..3).map(|_| 5i); } diff --git a/src/test/run-make/unicode-input/span_length.rs b/src/test/run-make/unicode-input/span_length.rs index 28b993ba69b..0ad43ea0171 100644 --- a/src/test/run-make/unicode-input/span_length.rs +++ b/src/test/run-make/unicode-input/span_length.rs @@ -45,7 +45,7 @@ fn main() { let _ = write!(&mut File::create(&main_file).unwrap(), "#![feature(non_ascii_idents)] fn main() {{ {} }}", // random string of length n - range(0, n).map(|_| random_char()).collect::<String>()); + (0..n).map(|_| random_char()).collect::<String>()); } // rustc is passed to us with --out-dir and -L etc., so we diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 4416c57e345..b8e19d37026 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -26,7 +26,7 @@ fn add_int(x: &mut Ints, v: int) { fn iter_ints<F>(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool { let l = x.values.len(); - range(0u, l).all(|i| f(&x.values[i])) + (0u..l).all(|i| f(&x.values[i])) } pub fn main() { diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index c3e04177cce..533d67e27eb 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -41,7 +41,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t { } pub fn main() { - range(0u, 100).map(|_| { + (0u..100).map(|_| { Thread::scoped(move|| { assert_eq!(count(5), 16); }) diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index f5e91b9de67..5201c934185 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -38,7 +38,7 @@ fn count(n: libc::uintptr_t) -> libc::uintptr_t { } pub fn main() { - range(0, 10u).map(|i| { + (0..10u).map(|i| { Thread::scoped(move|| { let result = count(5); println!("result = {}", result); diff --git a/src/test/run-pass/issue-15673.rs b/src/test/run-pass/issue-15673.rs index e66788a2c00..227d8f7b8c8 100644 --- a/src/test/run-pass/issue-15673.rs +++ b/src/test/run-pass/issue-15673.rs @@ -11,5 +11,5 @@ use std::iter::AdditiveIterator; fn main() { let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, range(0, 3).map(|i| x[i]).sum()); + assert_eq!(6, (0..3).map(|i| x[i]).sum()); } diff --git a/src/test/run-pass/issue-18539.rs b/src/test/run-pass/issue-18539.rs index 90e20e30d10..f724af73422 100644 --- a/src/test/run-pass/issue-18539.rs +++ b/src/test/run-pass/issue-18539.rs @@ -19,5 +19,5 @@ fn uint_to_foo(_: uint) -> Foo { #[allow(unused_must_use)] fn main() { - range(0u, 10).map(uint_to_foo); + (0u..10).map(uint_to_foo); } diff --git a/src/test/run-pass/issue-2989.rs b/src/test/run-pass/issue-2989.rs index bef082569b9..fecef2f87d8 100644 --- a/src/test/run-pass/issue-2989.rs +++ b/src/test/run-pass/issue-2989.rs @@ -21,7 +21,7 @@ impl methods for () { // the position of this function is significant! - if it comes before methods // then it works, if it comes after it then it doesn't! fn to_bools(bitv: Storage) -> Vec<bool> { - range(0, 8).map(|i| { + (0..8).map(|i| { let w = i / 64; let b = i % 64; let x = 1u64 & (bitv.storage[w] >> b); diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 80ee735be70..09507afb9ce 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -153,7 +153,7 @@ unsafe fn test_triangle() -> bool { // Test 3: turn triangle into a square, bottom to top. unsafe fn test_3(ascend: &mut [*mut u8]) { let new_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0u..COUNT / 2).rev() { let (p0, p1, old_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(old_size < new_size); @@ -168,7 +168,7 @@ unsafe fn test_triangle() -> bool { // Test 4: turn the square back into a triangle, bottom to top. unsafe fn test_4(ascend: &mut [*mut u8]) { let old_size = idx_to_size(COUNT-1); - for i in range(0u, COUNT / 2).rev() { + for i in (0u..COUNT / 2).rev() { let (p0, p1, new_size) = (ascend[2*i], ascend[2*i+1], idx_to_size(i)); assert!(new_size < old_size); diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index 32f9de71d53..efc1913a205 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -36,7 +36,7 @@ fn start(argc: int, argv: *const *const u8) -> int { } let args = unsafe { - range(0, argc as uint).map(|i| { + (0..argc as uint).map(|i| { let ptr = *argv.offset(i as int) as *const _; ffi::c_str_to_bytes(&ptr).to_vec() }).collect::<Vec<_>>() diff --git a/src/test/run-pass/tcp-accept-stress.rs b/src/test/run-pass/tcp-accept-stress.rs index fbe2309964b..07e61733a56 100644 --- a/src/test/run-pass/tcp-accept-stress.rs +++ b/src/test/run-pass/tcp-accept-stress.rs @@ -34,7 +34,7 @@ fn test() { let (srv_tx, srv_rx) = channel(); let (cli_tx, cli_rx) = channel(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let a = a.clone(); let cnt = cnt.clone(); let srv_tx = srv_tx.clone(); @@ -55,7 +55,7 @@ fn test() { }) }).collect::<Vec<_>>(); - let _t = range(0, N).map(|_| { + let _t = (0..N).map(|_| { let cli_tx = cli_tx.clone(); Thread::scoped(move|| { for _ in range(0, M) { diff --git a/src/test/run-pass/typeck_type_placeholder_1.rs b/src/test/run-pass/typeck_type_placeholder_1.rs index a8ae3f40f0e..b2f6dad9988 100644 --- a/src/test/run-pass/typeck_type_placeholder_1.rs +++ b/src/test/run-pass/typeck_type_placeholder_1.rs @@ -21,11 +21,11 @@ static CONSTEXPR: TestStruct = TestStruct{x: &413 as *const _}; pub fn main() { - let x: Vec<_> = range(0u, 5).collect(); + let x: Vec<_> = (0u..5).collect(); let expected: &[uint] = &[0,1,2,3,4]; assert_eq!(x.as_slice(), expected); - let x = range(0u, 5).collect::<Vec<_>>(); + let x = (0u..5).collect::<Vec<_>>(); assert_eq!(x.as_slice(), expected); let y: _ = "hello"; diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 90f4b2e6344..8b9c65c7ca8 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -22,7 +22,7 @@ pub fn main() { let (tx, rx) = channel(); let n = 100u; let mut expected = 0u; - let _t = range(0u, n).map(|i| { + let _t = (0u..n).map(|i| { expected += i; let tx = tx.clone(); Thread::scoped(move|| { diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index 4e5d61f166c..ef48bdff11d 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -55,7 +55,7 @@ fn find_zombies() { } fn main() { let too_long = format!("/NoSuchCommand{:0300}", 0u8); - let _failures = range(0, 100).map(|_| { + let _failures = (0..100).map(|_| { let cmd = Command::new(too_long.as_slice()); let failed = cmd.spawn(); assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd); |
