mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Replace if let
with match
where appropriate
This commit is contained in:
parent
f29796da61
commit
9583dd5725
44 changed files with 201 additions and 269 deletions
|
@ -509,10 +509,9 @@ impl<'a> CompletionContext<'a> {
|
|||
.and_then(|pat| self.sema.type_of_pat(&pat))
|
||||
.or_else(|| it.initializer().and_then(|it| self.sema.type_of_expr(&it)))
|
||||
.map(TypeInfo::original);
|
||||
let name = if let Some(ast::Pat::IdentPat(ident)) = it.pat() {
|
||||
ident.name().map(NameOrNameRef::Name)
|
||||
} else {
|
||||
None
|
||||
let name = match it.pat() {
|
||||
Some(ast::Pat::IdentPat(ident)) => ident.name().map(NameOrNameRef::Name),
|
||||
Some(_) | None => None,
|
||||
};
|
||||
|
||||
(ty, name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue