mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-25 11:17:13 +00:00
Replace unnecessary use of MacroDefId
with MacroId
This commit is contained in:
parent
aa2d234426
commit
155ef3de60
@ -62,8 +62,8 @@ use std::ops::Deref;
|
||||
|
||||
use base_db::Crate;
|
||||
use hir_expand::{
|
||||
EditionedFileId, ErasedAstId, HirFileId, InFile, MacroCallId, MacroDefId, mod_path::ModPath,
|
||||
name::Name, proc_macro::ProcMacroKind,
|
||||
EditionedFileId, ErasedAstId, HirFileId, InFile, MacroCallId, mod_path::ModPath, name::Name,
|
||||
proc_macro::ProcMacroKind,
|
||||
};
|
||||
use intern::Symbol;
|
||||
use itertools::Itertools;
|
||||
@ -189,7 +189,7 @@ pub struct DefMap {
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
struct DefMapCrateData {
|
||||
/// Side table for resolving derive helpers.
|
||||
exported_derives: FxHashMap<MacroDefId, Box<[Name]>>,
|
||||
exported_derives: FxHashMap<MacroId, Box<[Name]>>,
|
||||
fn_proc_macro_mapping: FxHashMap<FunctionId, ProcMacroId>,
|
||||
|
||||
/// Custom attributes registered with `#![register_attr]`.
|
||||
|
@ -609,7 +609,7 @@ impl<'db> DefCollector<'db> {
|
||||
self.define_proc_macro(def.name.clone(), proc_macro_id);
|
||||
let crate_data = Arc::get_mut(&mut self.def_map.data).unwrap();
|
||||
if let ProcMacroKind::Derive { helpers } = def.kind {
|
||||
crate_data.exported_derives.insert(self.db.macro_def(proc_macro_id.into()), helpers);
|
||||
crate_data.exported_derives.insert(proc_macro_id.into(), helpers);
|
||||
}
|
||||
crate_data.fn_proc_macro_mapping.insert(fn_id, proc_macro_id);
|
||||
}
|
||||
@ -1345,7 +1345,7 @@ impl<'db> DefCollector<'db> {
|
||||
// Record its helper attributes.
|
||||
if def_id.krate != self.def_map.krate {
|
||||
let def_map = crate_def_map(self.db, def_id.krate);
|
||||
if let Some(helpers) = def_map.data.exported_derives.get(&def_id) {
|
||||
if let Some(helpers) = def_map.data.exported_derives.get(¯o_id) {
|
||||
self.def_map
|
||||
.derive_helpers_in_scope
|
||||
.entry(ast_id.ast_id.map(|it| it.upcast()))
|
||||
@ -2425,7 +2425,7 @@ impl ModCollector<'_, '_> {
|
||||
Arc::get_mut(&mut self.def_collector.def_map.data)
|
||||
.unwrap()
|
||||
.exported_derives
|
||||
.insert(self.def_collector.db.macro_def(macro_id.into()), helpers);
|
||||
.insert(macro_id.into(), helpers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user