mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 19:13:29 +00:00
228 lines
6.6 KiB
Text
228 lines
6.6 KiB
Text
error: this `match` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:13:20
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ____________________^
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:13:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ replace this binding
|
|
LL |
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
= note: `-D clippy::collapsible-match` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::collapsible_match)]`
|
|
|
|
error: this `match` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:23:20
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ____________________^
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:23:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ replace this binding
|
|
LL |
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:33:9
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | |
|
|
LL | | take(n);
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:32:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:41:9
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | |
|
|
LL | | take(n);
|
|
LL | | } else {
|
|
LL | | return;
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:40:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `match` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:53:9
|
|
|
|
|
LL | / match val {
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => (),
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:52:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ replace this binding
|
|
...
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:63:13
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | |
|
|
LL | | take(n);
|
|
LL | | }
|
|
| |_____________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:62:12
|
|
|
|
|
LL | Ok(val) => {
|
|
| ^^^ replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `match` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:73:9
|
|
|
|
|
LL | / match val {
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:72:15
|
|
|
|
|
LL | if let Ok(val) = res_opt {
|
|
| ^^^ replace this binding
|
|
...
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:85:13
|
|
|
|
|
LL | / if let Some(n) = val {
|
|
LL | |
|
|
LL | | take(n);
|
|
LL | | } else {
|
|
LL | | return;
|
|
LL | | }
|
|
| |_____________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:84:12
|
|
|
|
|
LL | Ok(val) => {
|
|
| ^^^ replace this binding
|
|
LL | if let Some(n) = val {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `match` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:97:20
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ____________________^
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | None => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:97:12
|
|
|
|
|
LL | Ok(val) => match val {
|
|
| ^^^ replace this binding
|
|
LL |
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `match` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:107:22
|
|
|
|
|
LL | Some(val) => match val {
|
|
| ______________________^
|
|
LL | |
|
|
LL | | Some(n) => foo(n),
|
|
LL | | _ => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:107:14
|
|
|
|
|
LL | Some(val) => match val {
|
|
| ^^^ replace this binding
|
|
LL |
|
|
LL | Some(n) => foo(n),
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:273:9
|
|
|
|
|
LL | / if let Some(u) = a {
|
|
LL | |
|
|
LL | | println!("{u:?}")
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:272:27
|
|
|
|
|
LL | if let Issue9647::A { a, .. } = x {
|
|
| ^ replace this binding
|
|
LL | if let Some(u) = a {
|
|
| ^^^^^^^ with this pattern, prefixed by a:
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:282:9
|
|
|
|
|
LL | / if let Some(u) = a {
|
|
LL | |
|
|
LL | | println!("{u}")
|
|
LL | | }
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:281:35
|
|
|
|
|
LL | if let Issue9647::A { a: Some(a), .. } = x {
|
|
| ^ replace this binding
|
|
LL | if let Some(u) = a {
|
|
| ^^^^^^^ with this pattern
|
|
|
|
error: aborting due to 12 previous errors
|
|
|