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 authored and mdinger committed Apr 24, 2015
1 parent 5e8e657 commit a62d5be
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 @@ -2897,7 +2897,7 @@ loops](#infinite-loops), [break expressions](#break-expressions), and
### For expressions

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 @@ -2910,8 +2910,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 a62d5be

Please sign in to comment.