diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-06-16 14:31:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-16 14:31:14 +0200 |
| commit | 1a561844606a4b823d1a1cf88c9cf6fbcce53673 (patch) | |
| tree | 97b47be2dd9583cae6140f16f415d88e2ba59a6c /compiler/rustc_parse/src/parser | |
| parent | dc1668282478095cbf85146e333ba45ad6aae20c (diff) | |
| parent | 96fd9fc2dd8aa45ab19c2e07ed172b50566215ac (diff) | |
| download | rust-1a561844606a4b823d1a1cf88c9cf6fbcce53673.tar.gz rust-1a561844606a4b823d1a1cf88c9cf6fbcce53673.zip | |
Rollup merge of #142530 - fee1-dead-contrib:push-klusvwusyqvq, r=compiler-errors
use `if let` guards where possible these crates already enable the feature
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index b49a13ce584..215202c4bd5 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2273,23 +2273,18 @@ impl<'a> Parser<'a> { ), // Also catches `fn foo(&a)`. PatKind::Ref(ref inner_pat, mutab) - if matches!(inner_pat.clone().kind, PatKind::Ident(..)) => + if let PatKind::Ident(_, ident, _) = inner_pat.clone().kind => { - match inner_pat.clone().kind { - PatKind::Ident(_, ident, _) => { - let mutab = mutab.prefix_str(); - ( - ident, - "self: ", - format!("{ident}: &{mutab}TypeName"), - "_: ", - pat.span.shrink_to_lo(), - pat.span, - pat.span.shrink_to_lo(), - ) - } - _ => unreachable!(), - } + let mutab = mutab.prefix_str(); + ( + ident, + "self: ", + format!("{ident}: &{mutab}TypeName"), + "_: ", + pat.span.shrink_to_lo(), + pat.span, + pat.span.shrink_to_lo(), + ) } _ => { // Otherwise, try to get a type and emit a suggestion. |
