diff options
Diffstat (limited to 'src/tools/clippy/src/docs/iter_next_slice.txt')
-rw-r--r-- | src/tools/clippy/src/docs/iter_next_slice.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/iter_next_slice.txt b/src/tools/clippy/src/docs/iter_next_slice.txt new file mode 100644 index 000000000..1cea25eaf --- /dev/null +++ b/src/tools/clippy/src/docs/iter_next_slice.txt @@ -0,0 +1,16 @@ +### What it does +Checks for usage of `iter().next()` on a Slice or an Array + +### Why is this bad? +These can be shortened into `.get()` + +### Example +``` +a[2..].iter().next(); +b.iter().next(); +``` +should be written as: +``` +a.get(2); +b.get(0); +```
\ No newline at end of file |