Skip to content

Commit e5b5758

Browse files
committed
range -> ..
Fixes #389
1 parent f3f947c commit e5b5758

File tree

8 files changed

+11
-16
lines changed

8 files changed

+11
-16
lines changed

examples/bench/bench.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(test)]
2-
#![feature(core)]
32

43
extern crate test;
54

@@ -44,7 +43,7 @@ fn recursive_fibonacci(b: &mut Bencher) {
4443
// exact code to benchmark must be passed as a closure to the iter
4544
// method of Bencher
4645
b.iter(|| {
47-
range(0, BENCH_SIZE).map(fibonacci).collect::<Vec<u32>>()
46+
(0..BENCH_SIZE).map(fibonacci).collect::<Vec<u32>>()
4847
})
4948
}
5049

examples/iter/iter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ fn main() {
2929
// Iterator that generates: 0, 1 and 2
3030
let mut sequence = 0..3;
3131

32-
println!("Four consecutive `next` calls on range(0, 3)");
32+
println!("Four consecutive `next` calls on 0..3");
3333
println!("> {:?}", sequence.next());
3434
println!("> {:?}", sequence.next());
3535
println!("> {:?}", sequence.next());
3636
println!("> {:?}", sequence.next());
3737

3838
// The for construct will iterate an 'Iterator' until it returns 'None'.
3939
// Every 'Some' value is unwrapped and bound to a variable.
40-
println!("Iterate over range(0, 3) using for");
40+
println!("Iterate over 0..3 using for");
4141
for i in 0..3 {
4242
println!("> {}", i);
4343
}

examples/macros/dry/dry.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(core)]
2-
31
use std::iter;
42
use std::ops::{Add, Mul, Sub};
53

@@ -48,7 +46,7 @@ mod test {
4846
($func: ident, $x:expr, $y:expr, $z:expr) => {
4947
#[test]
5048
fn $func() {
51-
for size in range(0u32, 10) {
49+
for size in 0u32..10 {
5250
let mut x: Vec<_> = iter::repeat(size).take($x).collect();
5351
let y: Vec<_> = iter::repeat(size).take($y).collect();
5452
let z: Vec<_> = iter::repeat(size).take($z).collect();

examples/raii/raii.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(box_syntax)]
2-
#![feature(core)]
32

43
fn create_box() {
54
// Allocate an integer in the heap
@@ -21,7 +20,7 @@ fn main() {
2120
}
2221

2322
// Create lots of boxes
24-
for _ in range(0u32, 1_000) {
23+
for _ in 0u32..1_000 {
2524
create_box();
2625
}
2726

examples/simd/simd_add.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn simd_add_assign(xs: &mut Vec<f32>, ys: &Vec<f32>) {
3333
let p_y: *const f32 = ys.as_ptr();
3434

3535
// sum excess elements that don't fit in the simd vector
36-
for i in range(4 * chunks, size) {
36+
for i in (4 * chunks)..size {
3737
// dereferencing a raw pointer requires an unsafe block
3838
unsafe {
3939
// offset by i elements
@@ -46,7 +46,7 @@ fn simd_add_assign(xs: &mut Vec<f32>, ys: &Vec<f32>) {
4646
let simd_p_y = p_y as *const f32x4;
4747

4848
// sum "simd vector"
49-
for i in range(0, chunks) {
49+
for i in 0..chunks {
5050
unsafe {
5151
*simd_p_x.offset(i) += *simd_p_y.offset(i);
5252
}

examples/threads/threads.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(core)]
21
#![feature(std_misc)]
32

43
use std::thread::Thread;
@@ -7,7 +6,7 @@ static NTHREADS: i32 = 10;
76

87
// This is the `main` thread
98
fn main() {
10-
for i in range(0, NTHREADS) {
9+
for i in 0..NTHREADS {
1110
// Spin up another thread
1211
let _ = Thread::scoped(move || {
1312
println!("this is thread number {}", i)

examples/vec/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn main() {
22
// Iterators can be collected into vectors
3-
let collected_iterator: Vec<i32> = range(0, 10).collect();
4-
println!("Collected range(0, 10) into: {:?}", collected_iterator);
3+
let collected_iterator: Vec<i32> = (0..10).collect();
4+
println!("Collected (0..10) into: {:?}", collected_iterator);
55

66
// The `vec!` macro can be used to initialize a vector
77
let mut xs = vec![1i32, 2, 3];

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
nexamples += count;
3838
}
3939

40-
let mut entries = range(0, nexamples).map(|_| {
40+
let mut entries = (0..nexamples).map(|_| {
4141
rx.recv().unwrap()
4242
}).collect::<Vec<(Vec<uint>, String)>>();
4343

0 commit comments

Comments
 (0)