summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/while_let_on_iterator.txt
blob: af053c541199d0e62c4165410f5cd4859de11bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
### What it does
Checks for `while let` expressions on iterators.

### Why is this bad?
Readability. A simple `for` loop is shorter and conveys
the intent better.

### Example
```
while let Some(val) = iter.next() {
    ..
}
```

Use instead:
```
for val in &mut iter {
    ..
}
```