Skip to content

Commit

Permalink
[reference] Update 7.2.20: For expressions.
Browse files Browse the repository at this point in the history
* `for` loops now use `IntoIterator` instead of just `Iterator`
* Simplify the example by removing unnecessary `Vec::iter` call.
  • Loading branch information
mbrubeck committed Apr 24, 2015
1 parent c702f42 commit 7fef334
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3192,7 +3192,7 @@ for_expr : [ lifetime ':' ] "for" pat "in" no_struct_literal_expr '{' block '}'
```

A `for` expression is a syntactic construct for looping over elements provided
by an implementation of `std::iter::Iterator`.
by an implementation of `std::iter::IntoIterator`.

An example of a for loop over the contents of an array:

Expand All @@ -3205,8 +3205,8 @@ An example of a for loop over the contents of an array:
let v: &[Foo] = &[a, b, c];
for e in v.iter() {
bar(*e);
for e in v {
bar(e);
}
```

Expand Down

0 comments on commit 7fef334

Please sign in to comment.