mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Merge #10944
10944: internal: Prefer resolution of inert attributes r=Veykril a=Veykril Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10942 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
7d6fcbc0be
1 changed files with 10 additions and 11 deletions
|
@ -335,17 +335,16 @@ impl SourceAnalyzer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if is_path_of_attr {
|
} else if is_path_of_attr {
|
||||||
let res = resolve_hir_path_as_macro(db, &self.resolver, &hir_path);
|
let name_ref = path.as_single_name_ref();
|
||||||
return match res {
|
let builtin =
|
||||||
Some(_) => res.map(PathResolution::Macro),
|
name_ref.as_ref().map(ast::NameRef::text).as_deref().and_then(BuiltinAttr::by_name);
|
||||||
None => path.as_single_name_ref().and_then(|name_ref| {
|
if let builtin @ Some(_) = builtin {
|
||||||
if let builtin @ Some(_) = BuiltinAttr::by_name(&name_ref.text()) {
|
return builtin.map(PathResolution::BuiltinAttr);
|
||||||
builtin.map(PathResolution::BuiltinAttr)
|
|
||||||
} else if let tool @ Some(_) = ToolModule::by_name(&name_ref.text()) {
|
|
||||||
tool.map(PathResolution::ToolModule)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
return match resolve_hir_path_as_macro(db, &self.resolver, &hir_path) {
|
||||||
|
res @ Some(m) if m.is_attr() => res.map(PathResolution::Macro),
|
||||||
|
_ => name_ref.and_then(|name_ref| {
|
||||||
|
ToolModule::by_name(&name_ref.text()).map(PathResolution::ToolModule)
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue