2021-08-19 13:31:25 -05:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:13:34
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | Ok(val) if make() => match val {
|
|
|
|
| __________________________________^
|
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_____________^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
2021-02-25 04:25:22 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:13:16
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | Ok(val) if make() => match val {
|
2021-02-25 04:25:22 -06:00
|
|
|
| ^^^ replace this binding
|
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`
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:20:24
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
|
|
|
| ________________________^
|
|
|
|
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
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:20:16
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
2021-02-25 04:25:22 -06:00
|
|
|
| ^^^ replace this binding
|
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`
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:34:29
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | $pat => match $e {
|
|
|
|
| _____________________________^
|
|
|
|
LL | | $inner_pat => $then,
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_____________________^
|
|
|
|
...
|
|
|
|
LL | mac!(res_opt => Ok(val), val => Some(n), foo(n));
|
|
|
|
| ------------------------------------------------- in this macro invocation
|
|
|
|
|
|
2021-02-25 04:25:22 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:46:28
|
2020-12-06 08:01:03 -06:00
|
|
|
|
|
|
|
|
LL | mac!(res_opt => Ok(val), val => Some(n), foo(n));
|
|
|
|
| ^^^ ^^^^^^^ with this pattern
|
|
|
|
| |
|
2021-02-25 04:25:22 -06:00
|
|
|
| replace this binding
|
2021-02-13 13:52:25 -06:00
|
|
|
= note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
|
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`
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:51:20
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | Some(s) => match *s {
|
|
|
|
| ____________________^
|
|
|
|
LL | | [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
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:51:14
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | Some(s) => match *s {
|
2021-02-25 04:25:22 -06:00
|
|
|
| ^ replace this binding
|
2021-01-30 11:06:34 -06:00
|
|
|
LL | [n] => foo(n),
|
|
|
|
| ^^^ with this pattern
|
|
|
|
|
2021-08-19 13:31:25 -05:00
|
|
|
error: this `match` can be collapsed into the outer `match`
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:60:24
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | Some(ref s) => match &*s {
|
|
|
|
| ________________________^
|
|
|
|
LL | | [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
|
2021-04-08 10:50:13 -05:00
|
|
|
--> $DIR/collapsible_match2.rs:60:14
|
2021-01-30 11:06:34 -06:00
|
|
|
|
|
|
|
|
LL | Some(ref s) => match &*s {
|
2021-02-25 04:25:22 -06:00
|
|
|
| ^^^^^ replace this binding
|
2021-01-30 11:06:34 -06:00
|
|
|
LL | [n] => foo(n),
|
|
|
|
| ^^^ with this pattern
|
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2020-12-06 08:01:03 -06:00
|
|
|
|