From fe38fffaa90f656abbeff7b8a167afc45cc492a9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 22 Dec 2019 15:04:31 +0100 Subject: Minor rename --- crates/ra_hir_def/src/item_scope.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs index 9e082c5f7..eab3e2fff 100644 --- a/crates/ra_hir_def/src/item_scope.rs +++ b/crates/ra_hir_def/src/item_scope.rs @@ -9,7 +9,7 @@ use crate::{per_ns::PerNs, BuiltinType, ImplId, MacroDefId, ModuleDefId, TraitId #[derive(Debug, Default, PartialEq, Eq)] pub struct ItemScope { - items: FxHashMap, + visible: FxHashMap, impls: Vec, /// Macros visible in current module in legacy textual scope /// @@ -49,7 +49,7 @@ pub(crate) enum BuiltinShadowMode { impl ItemScope { pub fn entries<'a>(&'a self) -> impl Iterator + 'a { //FIXME: shadowing - self.items.iter().chain(BUILTIN_SCOPE.iter()) + self.visible.iter().chain(BUILTIN_SCOPE.iter()) } pub fn declarations(&self) -> impl Iterator + '_ { @@ -66,7 +66,7 @@ impl ItemScope { /// Iterate over all module scoped macros pub(crate) fn macros<'a>(&'a self) -> impl Iterator + 'a { - self.items + self.visible .iter() .filter_map(|(name, res)| res.def.take_macros().map(|macro_| (name, macro_))) } @@ -79,9 +79,9 @@ impl ItemScope { /// Get a name from current module scope, legacy macros are not included pub(crate) fn get(&self, name: &Name, shadow: BuiltinShadowMode) -> Option<&Resolution> { match shadow { - BuiltinShadowMode::Module => self.items.get(name).or_else(|| BUILTIN_SCOPE.get(name)), + BuiltinShadowMode::Module => self.visible.get(name).or_else(|| BUILTIN_SCOPE.get(name)), BuiltinShadowMode::Other => { - let item = self.items.get(name); + let item = self.visible.get(name); if let Some(res) = item { if let Some(ModuleDefId::ModuleId(_)) = res.def.take_types() { return BUILTIN_SCOPE.get(name).or(item); @@ -94,7 +94,7 @@ impl ItemScope { } pub(crate) fn traits<'a>(&'a self) -> impl Iterator + 'a { - self.items.values().filter_map(|r| match r.def.take_types() { + self.visible.values().filter_map(|r| match r.def.take_types() { Some(ModuleDefId::TraitId(t)) => Some(t), _ => None, }) @@ -114,7 +114,7 @@ impl ItemScope { pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, import: bool) -> bool { let mut changed = false; - let existing = self.items.entry(name.clone()).or_default(); + 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; @@ -139,7 +139,7 @@ impl ItemScope { } pub(crate) fn collect_resolutions(&self) -> Vec<(Name, Resolution)> { - self.items.iter().map(|(name, res)| (name.clone(), res.clone())).collect() + self.visible.iter().map(|(name, res)| (name.clone(), res.clone())).collect() } pub(crate) fn collect_legacy_macros(&self) -> FxHashMap { -- cgit v1.2.3