Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/static_index.rs')
| -rw-r--r-- | crates/ide/src/static_index.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs index aa62e2eae5..eb1a04c3f7 100644 --- a/crates/ide/src/static_index.rs +++ b/crates/ide/src/static_index.rs @@ -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)); |