rust-clippy/tests/ui/manual_flatten.stderr

200 lines
5.2 KiB
Text
Raw Normal View History

2021-02-02 18:04:20 +00:00
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:7:5
2021-01-29 00:38:34 +00:00
|
LL | for n in x {
| ^ - help: try: `x.into_iter().flatten()`
| _____|
| |
LL | | if let Some(y) = n {
LL | | println!("{}", y);
2021-01-29 00:38:34 +00:00
LL | | }
LL | | }
| |_____^
2021-01-29 00:38:34 +00:00
|
= note: `-D clippy::manual-flatten` implied by `-D warnings`
help: ...and remove the `if let` statement in the for loop
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:8:9
|
LL | / if let Some(y) = n {
LL | | println!("{}", y);
LL | | }
| |_________^
2021-01-29 00:38:34 +00:00
2021-02-02 18:04:20 +00:00
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:15:5
2021-01-29 00:38:34 +00:00
|
LL | for n in y.clone() {
| ^ --------- help: try: `y.clone().into_iter().flatten()`
| _____|
| |
2021-01-29 00:38:34 +00:00
LL | | if let Ok(n) = n {
LL | | println!("{}", n);
2021-02-02 18:04:20 +00:00
LL | | };
2021-01-29 00:38:34 +00:00
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:16:9
|
LL | / if let Ok(n) = n {
LL | | println!("{}", n);
LL | | };
| |_________^
2021-02-02 18:04:20 +00:00
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:22:5
2021-01-29 00:38:34 +00:00
|
LL | for n in &y {
| ^ -- help: try: `y.iter().flatten()`
| _____|
| |
2021-02-02 18:04:20 +00:00
LL | | if let Ok(n) = n {
LL | | println!("{}", n);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2021-03-24 15:15:15 +00:00
--> $DIR/manual_flatten.rs:23:9
|
LL | / if let Ok(n) = n {
LL | | println!("{}", n);
LL | | }
| |_________^
2021-01-29 00:38:34 +00:00
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:30:5
2021-01-29 00:38:34 +00:00
|
LL | for n in z {
2022-02-01 04:44:24 +00:00
| ^ - help: try: `z.iter().flatten()`
| _____|
| |
LL | | if let Ok(n) = n {
2021-01-29 00:38:34 +00:00
LL | | println!("{}", n);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:31:9
|
LL | / if let Ok(n) = n {
LL | | println!("{}", n);
LL | | }
| |_________^
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:39:5
|
LL | for n in z {
| ^ - help: try: `z.flatten()`
| _____|
| |
LL | | if let Some(m) = n {
LL | | println!("{}", m);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:40:9
|
LL | / if let Some(m) = n {
LL | | println!("{}", m);
LL | | }
| |_________^
2021-01-29 00:38:34 +00:00
2021-03-24 15:15:15 +00:00
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:72:5
2021-03-24 15:15:15 +00:00
|
LL | for n in &vec_of_ref {
| ^ ----------- help: try: `vec_of_ref.iter().copied().flatten()`
| _____|
| |
LL | | if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:73:9
2021-03-24 15:15:15 +00:00
|
LL | / if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
| |_________^
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:79:5
2021-03-24 15:15:15 +00:00
|
LL | for n in vec_of_ref {
2022-02-01 04:44:24 +00:00
| ^ ---------- help: try: `vec_of_ref.iter().copied().flatten()`
2021-03-24 15:15:15 +00:00
| _____|
| |
LL | | if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:80:9
2021-03-24 15:15:15 +00:00
|
LL | / if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
| |_________^
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:86:5
2021-03-24 15:15:15 +00:00
|
LL | for n in slice_of_ref {
2022-02-01 04:44:24 +00:00
| ^ ------------ help: try: `slice_of_ref.iter().copied().flatten()`
2021-03-24 15:15:15 +00:00
| _____|
| |
LL | | if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
LL | | }
| |_____^
|
help: ...and remove the `if let` statement in the for loop
2022-02-01 04:44:24 +00:00
--> $DIR/manual_flatten.rs:87:9
2021-03-24 15:15:15 +00:00
|
LL | / if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
| |_________^
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> $DIR/manual_flatten.rs:116:5
|
LL | / for n in vec![
LL | | Some(1),
LL | | Some(2),
LL | | Some(3)
... |
LL | | }
LL | | }
| |_____^
|
help: remove the `if let` statement in the for loop and then...
--> $DIR/manual_flatten.rs:121:9
|
LL | / if let Some(n) = n {
LL | | println!("{:?}", n);
LL | | }
| |_________^
help: try
|
LL ~ for n in vec![
LL + Some(1),
LL + Some(2),
LL + Some(3)
LL ~ ].iter().flatten() {
|
error: aborting due to 9 previous errors
2021-01-29 00:38:34 +00:00