mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +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
|
@ -103,10 +103,9 @@ impl StaticIndex<'_> {
|
|||
for token in tokens {
|
||||
let range = token.text_range();
|
||||
let node = token.parent().unwrap();
|
||||
let def = if let Some(x) = get_definition(&sema, token.clone()) {
|
||||
x
|
||||
} else {
|
||||
continue;
|
||||
let def = match get_definition(&sema, token.clone()) {
|
||||
Some(x) => x,
|
||||
None => continue,
|
||||
};
|
||||
let id = if let Some(x) = self.def_map.get(&def) {
|
||||
*x
|
||||
|
@ -124,10 +123,9 @@ impl StaticIndex<'_> {
|
|||
let token = self.tokens.get_mut(id).unwrap();
|
||||
token.references.push(ReferenceData {
|
||||
range: FileRange { range, file_id },
|
||||
is_definition: if let Some(x) = def.try_to_nav(self.db) {
|
||||
x.file_id == file_id && x.focus_or_full_range() == range
|
||||
} else {
|
||||
false
|
||||
is_definition: match def.try_to_nav(self.db) {
|
||||
Some(x) => x.file_id == file_id && x.focus_or_full_range() == range,
|
||||
None => false,
|
||||
},
|
||||
});
|
||||
result.tokens.push((range, id));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue