mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Fix iter_next_loop.rs
ui test
This commit is contained in:
parent
87f8a5b374
commit
a987c308cd
2 changed files with 7 additions and 5 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
fn main() {
|
||||
let x = [1, 2, 3, 4];
|
||||
for _ in vec.iter().next() {}
|
||||
for _ in x.iter().next() {}
|
||||
|
||||
struct Unrelated(&'static [u8]);
|
||||
impl Unrelated {
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
error[E0423]: expected value, found macro `vec`
|
||||
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
||||
--> tests/ui/iter_next_loop.rs:6:14
|
||||
|
|
||||
LL | for _ in vec.iter().next() {}
|
||||
| ^^^ not a value
|
||||
LL | for _ in x.iter().next() {}
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::iter-next-loop` implied by `-D warnings`
|
||||
= help: to override `-D warnings` add `#[allow(clippy::iter_next_loop)]`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0423`.
|
||||
|
|
Loading…
Reference in a new issue