mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 21:53:23 +00:00
4ffd66074a
changelog: Fix error suggestion of skip(..).next() for immutable variable.
46 lines
1.7 KiB
Text
46 lines
1.7 KiB
Text
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:16:28
|
|
|
|
|
LL | let _ = some_vec.iter().skip(42).next();
|
|
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)`
|
|
|
|
|
= note: `-D clippy::iter-skip-next` implied by `-D warnings`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:17:36
|
|
|
|
|
LL | let _ = some_vec.iter().cycle().skip(42).next();
|
|
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(42)`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:18:20
|
|
|
|
|
LL | let _ = (1..10).skip(10).next();
|
|
| ^^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(10)`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:19:33
|
|
|
|
|
LL | let _ = &some_vec[..].iter().skip(3).next();
|
|
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(3)`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:27:26
|
|
|
|
|
LL | let _: Vec<&str> = sp.skip(1).next().unwrap().split(' ').collect();
|
|
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:29:29
|
|
|
|
|
LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect();
|
|
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
|
|
|
error: called `skip(..).next()` on an iterator
|
|
--> $DIR/iter_skip_next.rs:35:29
|
|
|
|
|
LL | let _: Vec<&str> = s.skip(1).next().unwrap().split(' ').collect();
|
|
| ^^^^^^^^^^^^^^^ help: use `nth` instead: `.nth(1)`
|
|
|
|
error: aborting due to 7 previous errors
|
|
|