Unnamed repository; edit this file 'description' to name the repository.
misc improvements
Ada Alakbarova 13 days ago
parent 28ccb8b · commit 36bf49c
-rw-r--r--crates/hir-def/src/nameres/collector.rs11
-rw-r--r--crates/hir-expand/src/db.rs4
2 files changed, 4 insertions, 11 deletions
diff --git a/crates/hir-def/src/nameres/collector.rs b/crates/hir-def/src/nameres/collector.rs
index 3e66d4f3c8..25daf2c3f9 100644
--- a/crates/hir-def/src/nameres/collector.rs
+++ b/crates/hir-def/src/nameres/collector.rs
@@ -2531,12 +2531,8 @@ impl ModCollector<'_, '_> {
// Case 1: builtin macros
let expander = if attrs.by_key(sym::rustc_builtin_macro).exists() {
// `#[rustc_builtin_macro = "builtin_name"]` overrides the `macro_rules!` name.
- let name;
let name = match attrs.by_key(sym::rustc_builtin_macro).string_value_with_span() {
- Some((it, span)) => {
- name = Name::new_symbol(Symbol::intern(it), span.ctx);
- &name
- }
+ Some((it, span)) => &Name::new_symbol(Symbol::intern(it), span.ctx),
None => {
let explicit_name =
attrs.by_key(sym::rustc_builtin_macro).tt_values().next().and_then(|tt| {
@@ -2546,10 +2542,7 @@ impl ModCollector<'_, '_> {
}
});
match explicit_name {
- Some(ident) => {
- name = ident.as_name();
- &name
- }
+ Some(ident) => &ident.as_name(),
None => &mac.name,
}
}
diff --git a/crates/hir-expand/src/db.rs b/crates/hir-expand/src/db.rs
index 52ab072f9c..edc3a09d18 100644
--- a/crates/hir-expand/src/db.rs
+++ b/crates/hir-expand/src/db.rs
@@ -600,8 +600,8 @@ fn macro_expand<'db>(
fn proc_macro_span(db: &dyn ExpandDatabase, ast: AstId<ast::Fn>) -> Span {
let root = db.parse_or_expand(ast.file_id);
- let ast_id_map = &db.ast_id_map(ast.file_id);
- let span_map = &db.span_map(ast.file_id);
+ let ast_id_map = db.ast_id_map(ast.file_id);
+ let span_map = db.span_map(ast.file_id);
let node = ast_id_map.get(ast.value).to_node(&root);
let range = ast::HasName::name(&node)