rust/tests/ui/for_loops_over_fallibles.stderr

72 lines
2.7 KiB
Plaintext
Raw Normal View History

error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement.
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:9:14
|
2018-12-27 15:57:55 +00:00
LL | for x in option {
| ^^^^^^
|
2020-05-15 16:20:07 +00:00
= note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
= help: consider replacing `for x in option` 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.
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:14:14
|
2018-12-27 15:57:55 +00:00
LL | for x in result {
| ^^^^^^
|
= help: consider replacing `for x in result` with `if let Ok(x) = result`
error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement.
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:18:14
|
2018-12-27 15:57:55 +00:00
LL | for x in option.ok_or("x not found") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:24:14
|
2018-12-27 15:57:55 +00:00
LL | for x in v.iter().next() {
| ^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::iter_next_loop)]` on by default
error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement.
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:29:14
|
2018-12-27 15:57:55 +00:00
LL | for x in v.iter().next().and(Some(0)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`
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.
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:33:14
|
2018-12-27 15:57:55 +00:00
LL | for x in v.iter().next().ok_or("x not found") {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:45:5
|
2018-12-27 15:57:55 +00:00
LL | / while let Some(x) = option {
LL | | println!("{}", x);
LL | | break;
LL | | }
| |_____^
|
= note: `#[deny(clippy::never_loop)]` on by default
error: this loop never actually loops
2020-05-15 16:20:07 +00:00
--> $DIR/for_loops_over_fallibles.rs:51:5
|
2018-12-27 15:57:55 +00:00
LL | / while let Ok(x) = result {
LL | | println!("{}", x);
LL | | break;
LL | | }
| |_____^
error: aborting due to 8 previous errors