mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
remove useless conversions
This commit is contained in:
parent
cc80c5bd07
commit
efd2c20e96
17 changed files with 26 additions and 38 deletions
|
@ -67,7 +67,7 @@ pub(super) fn collect_defs(db: &dyn DefDatabase, mut def_map: DefMap, tree_id: T
|
|||
let dep_def_map = db.crate_def_map(dep.crate_id);
|
||||
let dep_root = dep_def_map.module_id(dep_def_map.root);
|
||||
|
||||
deps.insert(dep.as_name(), dep_root.into());
|
||||
deps.insert(dep.as_name(), dep_root);
|
||||
|
||||
if dep.is_prelude() && !tree_id.is_block() {
|
||||
def_map.extern_prelude.insert(dep.as_name(), dep_root);
|
||||
|
@ -2085,7 +2085,7 @@ impl ModCollector<'_, '_> {
|
|||
.scope
|
||||
.get_legacy_macro(name)
|
||||
.and_then(|it| it.last())
|
||||
.map(|&it| macro_id_to_def_id(self.def_collector.db, it.into()))
|
||||
.map(|&it| macro_id_to_def_id(self.def_collector.db, it))
|
||||
},
|
||||
)
|
||||
})
|
||||
|
|
|
@ -390,7 +390,7 @@ impl DefMap {
|
|||
.get_legacy_macro(name)
|
||||
// FIXME: shadowing
|
||||
.and_then(|it| it.last())
|
||||
.map_or_else(PerNs::none, |&m| PerNs::macros(m.into(), Visibility::Public));
|
||||
.map_or_else(PerNs::none, |&m| PerNs::macros(m, Visibility::Public));
|
||||
let from_scope = self[module].scope.get(name);
|
||||
let from_builtin = match self.block {
|
||||
Some(_) => {
|
||||
|
|
|
@ -381,7 +381,7 @@ impl Resolver {
|
|||
});
|
||||
def_map[module_id].scope.legacy_macros().for_each(|(name, macs)| {
|
||||
macs.iter().for_each(|&mac| {
|
||||
res.add(name, ScopeDef::ModuleDef(ModuleDefId::MacroId(MacroId::from(mac))));
|
||||
res.add(name, ScopeDef::ModuleDef(ModuleDefId::MacroId(mac)));
|
||||
})
|
||||
});
|
||||
def_map.extern_prelude().for_each(|(name, &def)| {
|
||||
|
@ -517,10 +517,7 @@ impl Scope {
|
|||
});
|
||||
m.def_map[m.module_id].scope.legacy_macros().for_each(|(name, macs)| {
|
||||
macs.iter().for_each(|&mac| {
|
||||
acc.add(
|
||||
name,
|
||||
ScopeDef::ModuleDef(ModuleDefId::MacroId(MacroId::from(mac))),
|
||||
);
|
||||
acc.add(name, ScopeDef::ModuleDef(ModuleDefId::MacroId(mac)));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue