mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-27 21:43:30 +00:00
1f4153aa1e
(see https://rustc-dev-guide.rust-lang.org/diagnostics.html for details)
179 lines
5 KiB
Text
179 lines
5 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: aborting due to 10 previous errors
|
|
|