mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
8224956dff
The `explicit_into_iter_loop`, `explicit_iter_loop` and `iter_next_loop` will now: - trigger only when the triggering expression is not located into macro code; - properly expose code rewrite proposal with code coming from the root context.
18 lines
682 B
Plaintext
18 lines
682 B
Plaintext
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 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: 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:26:14
|
|
|
|
|
LL | for _ in dbg!([1, 2].iter()).next() {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 2 previous errors
|
|
|