mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
246 lines
7.2 KiB
Text
246 lines
7.2 KiB
Text
error: this `match` can be collapsed into the outer `match`
|
|
--> tests/ui/collapsible_match.rs:14: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:14: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:24: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:24: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:34: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:33: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:42: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:41: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:54: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:53: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:64: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:63: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:74: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:73: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:86: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:85: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:98: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:98: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:108: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:108:14
|
|
|
|
|
LL | Some(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:252:22
|
|
|
|
|
LL | Some(val) => match val {
|
|
| ______________________^
|
|
LL | | E::A(val) | E::B(val) => foo(val),
|
|
LL | | _ => return,
|
|
LL | | },
|
|
| |_________^
|
|
|
|
|
help: the outer pattern can be modified to include the inner pattern
|
|
--> tests/ui/collapsible_match.rs:252:14
|
|
|
|
|
LL | Some(val) => match val {
|
|
| ^^^ replace this binding
|
|
LL | E::A(val) | E::B(val) => foo(val),
|
|
| ^^^^^^^^^^^^^^^^^^^^^ with this pattern
|
|
|
|
error: this `if let` can be collapsed into the outer `if let`
|
|
--> tests/ui/collapsible_match.rs:283: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:282: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:292: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:291: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 13 previous errors
|
|
|