2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:14:20
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
|
|
|
| ____________________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:14:12
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::collapsible_match)]`
|
2020-12-06 14:01:03 +00:00
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:24:20
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
|
|
|
| ____________________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:24:12
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:34:9
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | take(n);
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:33:15
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | if let Some(n) = val {
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:42:9
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | take(n);
|
|
|
|
LL | | } else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:41:15
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | if let Some(n) = val {
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:54:9
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / match val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:53:15
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `if let` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:64:13
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | take(n);
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:63:12
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | if let Some(n) = val {
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:74:9
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / match val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:73:15
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `if let` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:86:13
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(n) = val {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | take(n);
|
|
|
|
LL | | } else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:85:12
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | if let Some(n) = val {
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:98:20
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
|
|
|
| ____________________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | None => return,
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:98:12
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-08-19 18:31:25 +00:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:108:22
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Some(val) => match val {
|
|
|
|
| ______________________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-25 10:25:22 +00:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:108:14
|
2020-12-06 14:01:03 +00:00
|
|
|
|
|
|
|
|
LL | Some(val) => match val {
|
2021-02-25 10:25:22 +00:00
|
|
|
| ^^^ replace this binding
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2020-12-06 14:01:03 +00:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2024-05-02 15:26:44 +00:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
|
|
|
--> tests/ui/collapsible_match.rs:252:22
|
|
|
|
|
|
|
|
|
LL | Some(val) => match val {
|
|
|
|
| ______________________^
|
|
|
|
LL | | E::A(val) | E::B(val) => foo(val),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
|
|
--> tests/ui/collapsible_match.rs:252:14
|
|
|
|
|
|
|
|
|
LL | Some(val) => match val {
|
|
|
|
| ^^^ replace this binding
|
|
|
|
LL | E::A(val) | E::B(val) => foo(val),
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ with this pattern
|
|
|
|
|
2022-10-23 13:18:45 +00:00
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:283:9
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(u) = a {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-10-23 13:18:45 +00:00
|
|
|
LL | | println!("{u:?}")
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:282:27
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
|
LL | if let Issue9647::A { a, .. } = x {
|
|
|
|
| ^ replace this binding
|
|
|
|
LL | if let Some(u) = a {
|
2024-08-24 21:34:45 +00:00
|
|
|
| ^^^^^^^ with this pattern, prefixed by `a`:
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:292:9
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
|
LL | / if let Some(u) = a {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-10-23 13:18:45 +00:00
|
|
|
LL | | println!("{u}")
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2024-05-02 15:26:44 +00:00
|
|
|
--> tests/ui/collapsible_match.rs:291:35
|
2022-10-23 13:18:45 +00:00
|
|
|
|
|
|
|
|
LL | if let Issue9647::A { a: Some(a), .. } = x {
|
|
|
|
| ^ replace this binding
|
|
|
|
LL | if let Some(u) = a {
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2024-05-02 15:26:44 +00:00
|
|
|
error: aborting due to 13 previous errors
|
2020-12-06 14:01:03 +00:00
|
|
|
|