Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/ui/iter_next_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/iter_next_loop.stderr
Original file line number Diff line number Diff line change
@@ -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`.