From bb22a4e386c13a17b518a3822d343f6dd3dc4398 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 22 Mar 2020 15:00:44 +0800 Subject: Add support for macro in symbo_index --- crates/ra_hir_def/src/body/lower.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index e8c58ed32..3cf0c66ea 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -453,7 +453,7 @@ impl ExprCollector<'_> { } } ast::Expr::MacroCall(e) => { - if let Some(name) = is_macro_rules(&e) { + if let Some(name) = e.is_macro_rules().map(|it| it.as_name()) { let mac = MacroDefId { krate: Some(self.expander.module.krate), ast_id: Some(self.expander.ast_id(&e)), @@ -697,16 +697,6 @@ impl ExprCollector<'_> { } } -fn is_macro_rules(m: &ast::MacroCall) -> Option { - let name = m.path()?.segment()?.name_ref()?.as_name(); - - if name == name![macro_rules] { - Some(m.name()?.as_name()) - } else { - None - } -} - impl From for BinaryOp { fn from(ast_op: ast::BinOp) -> Self { match ast_op { -- cgit v1.2.3