@@ -7,48 +7,72 @@ LL | for x in option {
77 = note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
88 = help: consider replacing `for x in option` with `if let Some(x) = option`
99
10- error: for loop over `result `, which is a `Result `. This is more readably written as an `if let` statement
10+ error: for loop over `option `, which is an `Option `. This is more readably written as an `if let` statement
1111 --> $DIR/for_loops_over_fallibles.rs:14:14
1212 |
13+ LL | for x in option.iter() {
14+ | ^^^^^^
15+ |
16+ = help: consider replacing `for x in option.iter()` with `if let Some(x) = option`
17+
18+ error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
19+ --> $DIR/for_loops_over_fallibles.rs:19:14
20+ |
1321LL | for x in result {
1422 | ^^^^^^
1523 |
1624 = help: consider replacing `for x in result` with `if let Ok(x) = result`
1725
26+ error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
27+ --> $DIR/for_loops_over_fallibles.rs:24:14
28+ |
29+ LL | for x in result.iter_mut() {
30+ | ^^^^^^
31+ |
32+ = help: consider replacing `for x in result.iter_mut()` with `if let Ok(x) = result`
33+
34+ error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
35+ --> $DIR/for_loops_over_fallibles.rs:29:14
36+ |
37+ LL | for x in result.into_iter() {
38+ | ^^^^^^
39+ |
40+ = help: consider replacing `for x in result.into_iter()` with `if let Ok(x) = result`
41+
1842error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
19- --> $DIR/for_loops_over_fallibles.rs:18 :14
43+ --> $DIR/for_loops_over_fallibles.rs:33 :14
2044 |
2145LL | for x in option.ok_or("x not found") {
2246 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2347 |
2448 = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
2549
2650error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
27- --> $DIR/for_loops_over_fallibles.rs:24 :14
51+ --> $DIR/for_loops_over_fallibles.rs:39 :14
2852 |
2953LL | for x in v.iter().next() {
3054 | ^^^^^^^^^^^^^^^
3155 |
3256 = note: `#[deny(clippy::iter_next_loop)]` on by default
3357
3458error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement
35- --> $DIR/for_loops_over_fallibles.rs:29 :14
59+ --> $DIR/for_loops_over_fallibles.rs:44 :14
3660 |
3761LL | for x in v.iter().next().and(Some(0)) {
3862 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3963 |
4064 = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
4165
4266error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
43- --> $DIR/for_loops_over_fallibles.rs:33 :14
67+ --> $DIR/for_loops_over_fallibles.rs:48 :14
4468 |
4569LL | for x in v.iter().next().ok_or("x not found") {
4670 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4771 |
4872 = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`
4973
5074error: this loop never actually loops
51- --> $DIR/for_loops_over_fallibles.rs:45 :5
75+ --> $DIR/for_loops_over_fallibles.rs:60 :5
5276 |
5377LL | / while let Some(x) = option {
5478LL | | println!("{}", x);
@@ -59,13 +83,13 @@ LL | | }
5983 = note: `#[deny(clippy::never_loop)]` on by default
6084
6185error: this loop never actually loops
62- --> $DIR/for_loops_over_fallibles.rs:51 :5
86+ --> $DIR/for_loops_over_fallibles.rs:66 :5
6387 |
6488LL | / while let Ok(x) = result {
6589LL | | println!("{}", x);
6690LL | | break;
6791LL | | }
6892 | |_____^
6993
70- error: aborting due to 8 previous errors
94+ error: aborting due to 11 previous errors
7195
0 commit comments