Skip to content

Commit 8f43714

Browse files
author
Michael Rosenberg
committed
More small syntax changes in reference.md
1 parent 21f278a commit 8f43714

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/doc/reference.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ parentheses. They are used to create [tuple-typed](#tuple-types) values.
26402640
```{.tuple}
26412641
(0,);
26422642
(0.0, 4.5);
2643-
("a", 4us, true);
2643+
("a", 4usize, true);
26442644
```
26452645

26462646
### Unit expressions
@@ -3163,7 +3163,7 @@ An example of a for loop over the contents of an array:
31633163
31643164
let v: &[Foo] = &[a, b, c];
31653165
3166-
for e in v.iter() {
3166+
for e in v {
31673167
bar(*e);
31683168
}
31693169
```
@@ -3694,12 +3694,12 @@ Within the body of an item that has type parameter declarations, the names of
36943694
its type parameters are types:
36953695

36963696
```ignore
3697-
fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
3697+
fn map<A: Clone, B: Clone, F: Fn(A) -> B>(f: F, xs: &[A]) -> Vec<B> {
36983698
if xs.is_empty() {
36993699
return vec![];
37003700
}
37013701
let first: B = f(xs[0].clone());
3702-
let mut rest: Vec<B> = map(f, xs.slice(1, xs.len()));
3702+
let mut rest: Vec<B> = map(f, &xs[1..]);
37033703
rest.insert(0, first);
37043704
return rest;
37053705
}

0 commit comments

Comments
 (0)