2021-02-19 03:02:17 -06:00
|
|
|
error: unnecessary nested match
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:8:34
|
|
|
|
|
|
|
|
|
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-19 03:02:17 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:8:16
|
|
|
|
|
|
|
|
|
LL | Ok(val) if make() => match val {
|
2021-02-19 03:02:17 -06:00
|
|
|
| ^^^ replace this binding
|
2020-11-29 18:21:21 -06:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
error: unnecessary nested match
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:15:24
|
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
|
|
|
| ________________________^
|
|
|
|
LL | | Some(n) => foo(n),
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | },
|
|
|
|
| |_____________^
|
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:15:16
|
|
|
|
|
|
|
|
|
LL | Ok(val) => match val {
|
2021-02-19 03:02:17 -06:00
|
|
|
| ^^^ replace this binding
|
2020-11-29 18:21:21 -06:00
|
|
|
LL | Some(n) => foo(n),
|
|
|
|
| ^^^^^^^ with this pattern
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
error: unnecessary nested match
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:29:29
|
|
|
|
|
|
|
|
|
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-19 03:02:17 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2020-11-29 18:21:21 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:41:28
|
|
|
|
|
|
|
|
|
LL | mac!(res_opt => Ok(val), val => Some(n), foo(n));
|
|
|
|
| ^^^ ^^^^^^^ with this pattern
|
|
|
|
| |
|
2021-02-19 03:02:17 -06:00
|
|
|
| replace this binding
|
2020-11-29 18:21:21 -06:00
|
|
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
error: unnecessary nested match
|
2021-01-21 19:21:12 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:46:20
|
|
|
|
|
|
|
|
|
LL | Some(s) => match *s {
|
|
|
|
| ____________________^
|
|
|
|
LL | | [n] => foo(n),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2021-01-21 19:21:12 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:46:14
|
|
|
|
|
|
|
|
|
LL | Some(s) => match *s {
|
2021-02-19 03:02:17 -06:00
|
|
|
| ^ replace this binding
|
2021-01-21 19:21:12 -06:00
|
|
|
LL | [n] => foo(n),
|
|
|
|
| ^^^ with this pattern
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
error: unnecessary nested match
|
2021-01-21 19:21:12 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:55:24
|
|
|
|
|
|
|
|
|
LL | Some(ref s) => match &*s {
|
|
|
|
| ________________________^
|
|
|
|
LL | | [n] => foo(n),
|
|
|
|
LL | | _ => (),
|
|
|
|
LL | | },
|
|
|
|
| |_________^
|
|
|
|
|
|
2021-02-19 03:02:17 -06:00
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
2021-01-21 19:21:12 -06:00
|
|
|
--> $DIR/collapsible_match2.rs:55:14
|
|
|
|
|
|
|
|
|
LL | Some(ref s) => match &*s {
|
2021-02-19 03:02:17 -06:00
|
|
|
| ^^^^^ replace this binding
|
2021-01-21 19:21:12 -06:00
|
|
|
LL | [n] => foo(n),
|
|
|
|
| ^^^ with this pattern
|
|
|
|
|
|
|
|
error: aborting due to 5 previous errors
|
2020-11-29 18:21:21 -06:00
|
|
|
|