Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/data.rs')
| -rw-r--r-- | crates/hir-def/src/data.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/crates/hir-def/src/data.rs b/crates/hir-def/src/data.rs index 668b436e01..3fdd09b004 100644 --- a/crates/hir-def/src/data.rs +++ b/crates/hir-def/src/data.rs @@ -640,22 +640,20 @@ impl<'a> AssocItemCollector<'a> { AssocItem::MacroCall(call) => { let file_id = self.expander.current_file_id(); let root = self.db.parse_or_expand(file_id); - if let Some(root) = root { - let call = &item_tree[call]; - - let ast_id_map = self.db.ast_id_map(file_id); - let macro_call = ast_id_map.get(call.ast_id).to_node(&root); - let _cx = stdx::panic_context::enter(format!( - "collect_items MacroCall: {macro_call}" - )); - if let Ok(res) = - self.expander.enter_expand::<ast::MacroItems>(self.db, macro_call) - { - self.collect_macro_items(res, &|| hir_expand::MacroCallKind::FnLike { - ast_id: InFile::new(file_id, call.ast_id), - expand_to: hir_expand::ExpandTo::Items, - }); - } + let call = &item_tree[call]; + + let ast_id_map = self.db.ast_id_map(file_id); + let macro_call = ast_id_map.get(call.ast_id).to_node(&root); + let _cx = stdx::panic_context::enter(format!( + "collect_items MacroCall: {macro_call}" + )); + if let Ok(res) = + self.expander.enter_expand::<ast::MacroItems>(self.db, macro_call) + { + self.collect_macro_items(res, &|| hir_expand::MacroCallKind::FnLike { + ast_id: InFile::new(file_id, call.ast_id), + expand_to: hir_expand::ExpandTo::Items, + }); } } } |