2021-02-11 14:04:38 +00:00
|
|
|
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:7:5
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | for n in x {
|
|
|
|
| ^ - help: try: `x.into_iter().flatten()`
|
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-02-11 14:04:38 +00:00
|
|
|
LL | | if let Some(y) = n {
|
|
|
|
LL | | println!("{}", y);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:9:9
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(y) = n {
|
|
|
|
LL | | println!("{}", y);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::manual-flatten` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_flatten)]`
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:16:5
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | for n in y.clone() {
|
|
|
|
| ^ --------- help: try: `y.clone().into_iter().flatten()`
|
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-02-11 14:04:38 +00:00
|
|
|
LL | | if let Ok(n) = n {
|
|
|
|
LL | | println!("{}", n);
|
|
|
|
LL | | };
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:18:9
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | / if let Ok(n) = n {
|
|
|
|
LL | | println!("{}", n);
|
|
|
|
LL | | };
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:24:5
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | for n in &y {
|
|
|
|
| ^ -- help: try: `y.iter().flatten()`
|
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-02-11 14:04:38 +00:00
|
|
|
LL | | if let Ok(n) = n {
|
|
|
|
LL | | println!("{}", n);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:26:9
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | / if let Ok(n) = n {
|
|
|
|
LL | | println!("{}", n);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
error: unnecessary `if let` since only the `Ok` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:33:5
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | for n in z {
|
2022-02-10 17:40:06 +00:00
|
|
|
| ^ - help: try: `z.iter().flatten()`
|
2021-02-11 14:04:38 +00:00
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-02-11 14:04:38 +00:00
|
|
|
LL | | if let Ok(n) = n {
|
|
|
|
LL | | println!("{}", n);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:35:9
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:43:5
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | for n in z {
|
|
|
|
| ^ - help: try: `z.flatten()`
|
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-02-11 14:04:38 +00:00
|
|
|
LL | | if let Some(m) = n {
|
|
|
|
LL | | println!("{}", m);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:45:9
|
2021-02-11 14:04:38 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(m) = n {
|
|
|
|
LL | | println!("{}", m);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
2021-03-25 18:29:11 +00:00
|
|
|
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:77:5
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
|
LL | for n in &vec_of_ref {
|
|
|
|
| ^ ----------- help: try: `vec_of_ref.iter().copied().flatten()`
|
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-03-25 18:29:11 +00:00
|
|
|
LL | | if let Some(n) = n {
|
|
|
|
LL | | println!("{:?}", n);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:79:9
|
2021-03-25 18:29:11 +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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:85:5
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
|
LL | for n in vec_of_ref {
|
2022-02-10 17:40:06 +00:00
|
|
|
| ^ ---------- help: try: `vec_of_ref.iter().copied().flatten()`
|
2021-03-25 18:29:11 +00:00
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-03-25 18:29:11 +00:00
|
|
|
LL | | if let Some(n) = n {
|
|
|
|
LL | | println!("{:?}", n);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:87:9
|
2021-03-25 18:29:11 +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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:93:5
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
|
LL | for n in slice_of_ref {
|
2022-02-10 17:40:06 +00:00
|
|
|
| ^ ------------ help: try: `slice_of_ref.iter().copied().flatten()`
|
2021-03-25 18:29:11 +00:00
|
|
|
| _____|
|
|
|
|
| |
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2021-03-25 18:29:11 +00:00
|
|
|
LL | | if let Some(n) = n {
|
|
|
|
LL | | println!("{:?}", n);
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: ...and remove the `if let` statement in the for loop
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:95:9
|
2021-03-25 18:29:11 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = n {
|
|
|
|
LL | | println!("{:?}", n);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
2022-07-18 07:39:37 +00:00
|
|
|
error: unnecessary `if let` since only the `Some` variant of the iterator element is used
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:124:5
|
2022-07-18 07:39:37 +00:00
|
|
|
|
|
|
|
|
LL | / for n in vec![
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-07-18 07:39:37 +00:00
|
|
|
LL | | Some(1),
|
|
|
|
LL | | Some(2),
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
help: remove the `if let` statement in the for loop and then...
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/manual_flatten.rs:130:9
|
2022-07-18 07:39:37 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = n {
|
|
|
|
LL | | println!("{:?}", n);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
help: try
|
|
|
|
|
|
|
|
|
LL ~ for n in vec![
|
2023-08-24 19:32:12 +00:00
|
|
|
LL +
|
2022-07-18 07:39:37 +00:00
|
|
|
LL + Some(1),
|
|
|
|
LL + Some(2),
|
|
|
|
LL + Some(3)
|
|
|
|
LL ~ ].iter().flatten() {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: aborting due to 9 previous errors
|
2021-02-11 14:04:38 +00:00
|
|
|
|