237 lines
7.1 KiB
Text
237 lines
7.1 KiB
Text
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:7:20
|
|
|
|
|
LL | Ok(val) => 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_match.rs:7:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:16:20
|
|
|
|
|
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_match.rs:16:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:25:9
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | | take(n);
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:24:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ Replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:32:9
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | | take(n);
|
|
LL | | } else {
|
|
LL | | return;
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:31:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ Replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:43:9
|
|
|
|
|
LL | / match val {
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:42:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ Replace this binding
|
|
LL | match val {
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:52:13
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | | take(n);
|
|
LL | | }
|
|
| |_____________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:51:12
|
|
|
|
|
LL | Ok(val) => {
|
|
| ^^^ Replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:61:9
|
|
|
|
|
LL | / match val {
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:60:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ Replace this binding
|
|
LL | match val {
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:72:13
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | | take(n);
|
|
LL | | } else {
|
|
LL | | return;
|
|
LL | | }
|
|
| |_____________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:71:12
|
|
|
|
|
LL | Ok(val) => {
|
|
| ^^^ Replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:83:20
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ____________________^
|
|
LL | | Some(n) => foo(n),
|
|
LL | | None => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:83:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:92:22
|
|
|
|
|
LL | Some(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_match.rs:92:14
|
|
|
|
|
LL | Some(val) => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:102:34
|
|
|
|
|
LL | Ok(val) if make() => match val {
|
|
| __________________________________^
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | },
|
|
| |_____________^
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:102:16
|
|
|
|
|
LL | Ok(val) if make() => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:109:24
|
|
|
|
|
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_match.rs:109:16
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ Replace this binding
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: Unnecessary nested match
|
|
--> $DIR/collapsible_match.rs:123: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
|
|
|
|
|
help: The outer pattern can be modified to include the inner pattern.
|
|
--> $DIR/collapsible_match.rs:135:28
|
|
|
|
|
LL | mac!(res_opt => Ok(val), val => Some(n), foo(n));
|
|
| ^^^ ^^^^^^^ with this pattern
|
|
| |
|
|
| Replace this binding
|
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: aborting due to 13 previous errors
|
|
|