Skip to content

Commit

Permalink
Auto merge of #13081 - GuillaumeGomez:fix-iter_next_loop.rs, r=y21
Browse files Browse the repository at this point in the history
Fix `iter_next_loop.rs` ui test

I'm uncovering bugs while working on #11421. ^^'

changelog: none
  • Loading branch information
bors committed Jul 10, 2024
2 parents 8d3b1f9 + a987c30 commit ef3cfaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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`.

0 comments on commit ef3cfaa

Please sign in to comment.