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