2021-03-12 14:30:50 +00:00
|
|
|
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:10:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in option {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in option` with `if let Some(x) = option`
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
|
2018-10-30 20:25:34 +00:00
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:15:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
LL | for x in option.iter() {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in option.iter()` with `if let Some(x) = option`
|
|
|
|
|
|
|
|
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:20:14
|
2022-06-16 15:39:06 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in result {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in result` with `if let Ok(x) = result`
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:25:14
|
2022-06-16 15:39:06 +00:00
|
|
|
|
|
|
|
|
LL | for x in result.iter_mut() {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in result.iter_mut()` with `if let Ok(x) = result`
|
|
|
|
|
|
|
|
error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:30:14
|
2022-06-16 15:39:06 +00:00
|
|
|
|
|
|
|
|
LL | for x in result.into_iter() {
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in result.into_iter()` with `if let Ok(x) = result`
|
|
|
|
|
2021-03-12 14:30:50 +00:00
|
|
|
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:34:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in option.ok_or("x not found") {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`
|
|
|
|
|
|
|
|
error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:40:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in v.iter().next() {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
|
2019-07-18 22:35:32 +00:00
|
|
|
= note: `#[deny(clippy::iter_next_loop)]` on by default
|
2018-10-30 20:25:34 +00:00
|
|
|
|
2021-03-12 14:30:50 +00:00
|
|
|
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:45:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in v.iter().next().and(Some(0)) {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
|
|
|
|
|
2021-03-12 14:30:50 +00:00
|
|
|
error: 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
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:49:14
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | for x in v.iter().next().ok_or("x not found") {
|
2018-10-30 20:25:34 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= 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")`
|
|
|
|
|
|
|
|
error: this loop never actually loops
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:61:5
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / while let Some(x) = option {
|
|
|
|
LL | | println!("{}", x);
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2018-10-30 20:25:34 +00:00
|
|
|
| |_____^
|
|
|
|
|
|
2019-07-18 22:35:32 +00:00
|
|
|
= note: `#[deny(clippy::never_loop)]` on by default
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2022-10-02 19:13:22 +00:00
|
|
|
--> $DIR/for_loops_over_fallibles.rs:67:5
|
2018-10-30 20:25:34 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / while let Ok(x) = result {
|
|
|
|
LL | | println!("{}", x);
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2018-10-30 20:25:34 +00:00
|
|
|
| |_____^
|
|
|
|
|
2022-06-16 15:39:06 +00:00
|
|
|
error: aborting due to 11 previous errors
|
2018-10-30 20:25:34 +00:00
|
|
|
|