]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/src/docs/iter_nth_zero.txt
Rollup merge of #101635 - jyn514:queries-new-derived, r=cjgillot
[rust.git] / src / tools / clippy / src / docs / iter_nth_zero.txt
1 ### What it does
2 Checks for the use of `iter.nth(0)`.
3
4 ### Why is this bad?
5 `iter.next()` is equivalent to
6 `iter.nth(0)`, as they both consume the next element,
7  but is more readable.
8
9 ### Example
10 ```
11 let x = s.iter().nth(0);
12 ```
13
14 Use instead:
15 ```
16 let x = s.iter().next();
17 ```