From 558956c84be5e8752986bae001c7fd3f06cbe86d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 22 Dec 2019 15:28:55 +0100 Subject: Remove import field --- crates/ra_hir_def/src/item_scope.rs | 13 ++----------- crates/ra_hir_def/src/nameres/collector.rs | 14 ++++++-------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs index b5c07ed5f..81089554f 100644 --- a/crates/ra_hir_def/src/item_scope.rs +++ b/crates/ra_hir_def/src/item_scope.rs @@ -30,9 +30,7 @@ pub struct ItemScope { static BUILTIN_SCOPE: Lazy> = Lazy::new(|| { BuiltinType::ALL .iter() - .map(|(name, ty)| { - (name.clone(), Resolution { def: PerNs::types(ty.clone().into()), import: false }) - }) + .map(|(name, ty)| (name.clone(), Resolution { def: PerNs::types(ty.clone().into()) })) .collect() }); @@ -113,29 +111,23 @@ impl ItemScope { self.legacy_macros.insert(name, mac); } - pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, import: bool) -> bool { + pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, _import: bool) -> bool { let mut changed = false; let existing = self.visible.entry(name.clone()).or_default(); if existing.def.types.is_none() && res.def.types.is_some() { existing.def.types = res.def.types; - existing.import = import || res.import; changed = true; } if existing.def.values.is_none() && res.def.values.is_some() { existing.def.values = res.def.values; - existing.import = import || res.import; changed = true; } if existing.def.macros.is_none() && res.def.macros.is_some() { existing.def.macros = res.def.macros; - existing.import = import || res.import; changed = true; } - if existing.def.is_none() && res.def.is_none() && !existing.import && res.import { - existing.import = res.import; - } changed } @@ -152,7 +144,6 @@ impl ItemScope { pub struct Resolution { /// None for unresolved pub def: PerNs, - pub(crate) import: bool, } impl From for PerNs { diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 745e31c0d..3706c1223 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -218,7 +218,7 @@ where self.update( self.def_map.root, None, - &[(name, Resolution { def: PerNs::macros(macro_), import: false })], + &[(name, Resolution { def: PerNs::macros(macro_) })], ); } } @@ -401,10 +401,8 @@ where .map(|(local_id, variant_data)| { let name = variant_data.name.clone(); let variant = EnumVariantId { parent: e, local_id }; - let res = Resolution { - def: PerNs::both(variant.into(), variant.into()), - import: true, - }; + let res = + Resolution { def: PerNs::both(variant.into(), variant.into()) }; (name, res) }) .collect::>(); @@ -430,7 +428,7 @@ where } } - let resolution = Resolution { def, import: true }; + let resolution = Resolution { def }; self.update(module_id, Some(import_id), &[(name, resolution)]); } None => tested_by!(bogus_paths), @@ -717,7 +715,7 @@ where let module = ModuleId { krate: self.def_collector.def_map.krate, local_id: res }; let def: ModuleDefId = module.into(); self.def_collector.def_map.modules[self.module_id].scope.define_def(def); - let resolution = Resolution { def: def.into(), import: false }; + let resolution = Resolution { def: def.into() }; self.def_collector.update(self.module_id, None, &[(name, resolution)]); res } @@ -777,7 +775,7 @@ where .into(), }; self.def_collector.def_map.modules[self.module_id].scope.define_def(def); - let resolution = Resolution { def: def.into(), import: false }; + let resolution = Resolution { def: def.into() }; self.def_collector.update(self.module_id, None, &[(name, resolution)]) } -- cgit v1.2.3