rust-clippy/tests/ui/collapsible_match2.stderr

98 lines
3.1 KiB
Text
Raw Normal View History

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