From 26c869ddc0cefc81899dceafb2bf14c66e1c5c54 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 10 Jun 2021 00:25:36 +0200 Subject: Don't classify attributes on macro-calls are the macro itself --- crates/ide_db/src/defs.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'crates/ide_db') diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index 1dcccbb8b..1b69d72f9 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs @@ -357,9 +357,9 @@ impl NameRefClass { } } - if let Some(macro_call) = parent.ancestors().find_map(ast::MacroCall::cast) { - if let Some(path) = macro_call.path() { - if path.qualifier().is_none() { + if let Some(path) = name_ref.syntax().ancestors().find_map(ast::Path::cast) { + if path.qualifier().is_none() { + if let Some(macro_call) = path.syntax().parent().and_then(ast::MacroCall::cast) { // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment // paths are handled below (allowing `log$0::info!` to resolve to the log crate). if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { @@ -367,9 +367,7 @@ impl NameRefClass { } } } - } - if let Some(path) = name_ref.syntax().ancestors().find_map(ast::Path::cast) { if let Some(resolved) = sema.resolve_path(&path) { if path.syntax().parent().and_then(ast::Attr::cast).is_some() { if let PathResolution::Def(ModuleDef::Function(func)) = resolved { -- cgit v1.2.3