]> git.lizzy.rs Git - rust.git/blob - src/docs/while_let_on_iterator.txt
Add iter_kv_map lint
[rust.git] / src / docs / while_let_on_iterator.txt
1 ### What it does
2 Checks for `while let` expressions on iterators.
3
4 ### Why is this bad?
5 Readability. A simple `for` loop is shorter and conveys
6 the intent better.
7
8 ### Example
9 ```
10 while let Some(val) = iter.next() {
11     ..
12 }
13 ```
14
15 Use instead:
16 ```
17 for val in &mut iter {
18     ..
19 }
20 ```