blob: ee02d9a4297605f033236c9fb70a4927c374e6ae [file] [log] [blame]
error: this loop never actually loops
--> tests/ui/never_loop_fixable.rs:4:5
|
LL | / for i in [1, 2, 3].iter() {
LL | |
LL | | return;
LL | | }
| |_____^
|
= note: `#[deny(clippy::never_loop)]` on by default
help: if you need the first element of the iterator, try writing
|
LL - for i in [1, 2, 3].iter() {
LL + if let Some(i) = [1, 2, 3].iter().next() {
|
error: this loop never actually loops
--> tests/ui/never_loop_fixable.rs:11:5
|
LL | / for i in [1, 2, 3].iter() {
LL | |
LL | | return;
LL | | loop {
... |
LL | | }
| |_____^
|
help: if you need the first element of the iterator, try writing
|
LL - for i in [1, 2, 3].iter() {
LL + if let Some(i) = [1, 2, 3].iter().next() {
|
error: aborting due to 2 previous errors