mirror of https://github.com/rust-lang/reference
Updated documentation to use range notation syntax.
Replaced outdated use of the `range(start, end)` function where approriate with `start..end`, and tweaked the examples to compile and run with the latest rust. I also fixed two periphery compile issues in reference.md which were occluding whether there were any new errors created by these changes, so I fixed them.
This commit is contained in:
parent
6d71012d28
commit
aed992e53b
|
@ -3005,7 +3005,7 @@ Some examples of call expressions:
|
|||
# fn add(x: i32, y: i32) -> i32 { 0 }
|
||||
|
||||
let x: i32 = add(1i32, 2i32);
|
||||
let pi: Option<f32> = "3.14".parse().ok();
|
||||
let pi: Option<f32> = "3.14".parse();
|
||||
```
|
||||
|
||||
### Lambda expressions
|
||||
|
@ -3148,7 +3148,7 @@ An example of a for loop over a series of integers:
|
|||
|
||||
```
|
||||
# fn bar(b:usize) { }
|
||||
for i in range(0us, 256) {
|
||||
for i in 0us..256 {
|
||||
bar(i);
|
||||
}
|
||||
```
|
||||
|
@ -3532,7 +3532,7 @@ An example of each kind:
|
|||
```{rust}
|
||||
let vec: Vec<i32> = vec![1, 2, 3];
|
||||
let arr: [i32; 3] = [1, 2, 3];
|
||||
let s: &[i32] = &vec;
|
||||
let s: &[i32] = &vec[];
|
||||
```
|
||||
|
||||
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
|
||||
|
|
Loading…
Reference in New Issue