use if let guards where possible
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user