Skip to content

Fix iter_next_loop.rs ui test #13081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2024
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`.