aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/item_scope.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs
index 62c878313..996d06db6 100644
--- a/crates/ra_hir_def/src/item_scope.rs
+++ b/crates/ra_hir_def/src/item_scope.rs
@@ -36,7 +36,7 @@ static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| {
36 36
37/// Shadow mode for builtin type which can be shadowed by module. 37/// Shadow mode for builtin type which can be shadowed by module.
38#[derive(Debug, Copy, Clone, PartialEq, Eq)] 38#[derive(Debug, Copy, Clone, PartialEq, Eq)]
39pub enum BuiltinShadowMode { 39pub(crate) enum BuiltinShadowMode {
40 // Prefer Module 40 // Prefer Module
41 Module, 41 Module,
42 // Prefer Other Types 42 // Prefer Other Types
@@ -60,19 +60,19 @@ impl ItemScope {
60 } 60 }
61 61
62 /// Iterate over all module scoped macros 62 /// Iterate over all module scoped macros
63 pub fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a { 63 pub(crate) fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a {
64 self.items 64 self.items
65 .iter() 65 .iter()
66 .filter_map(|(name, res)| res.def.take_macros().map(|macro_| (name, macro_))) 66 .filter_map(|(name, res)| res.def.take_macros().map(|macro_| (name, macro_)))
67 } 67 }
68 68
69 /// Iterate over all legacy textual scoped macros visable at the end of the module 69 /// Iterate over all legacy textual scoped macros visible at the end of the module
70 pub fn legacy_macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a { 70 pub(crate) fn legacy_macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a {
71 self.legacy_macros.iter().map(|(name, def)| (name, *def)) 71 self.legacy_macros.iter().map(|(name, def)| (name, *def))
72 } 72 }
73 73
74 /// Get a name from current module scope, legacy macros are not included 74 /// Get a name from current module scope, legacy macros are not included
75 pub fn get(&self, name: &Name, shadow: BuiltinShadowMode) -> Option<&Resolution> { 75 pub(crate) fn get(&self, name: &Name, shadow: BuiltinShadowMode) -> Option<&Resolution> {
76 match shadow { 76 match shadow {
77 BuiltinShadowMode::Module => self.items.get(name).or_else(|| BUILTIN_SCOPE.get(name)), 77 BuiltinShadowMode::Module => self.items.get(name).or_else(|| BUILTIN_SCOPE.get(name)),
78 BuiltinShadowMode::Other => { 78 BuiltinShadowMode::Other => {
@@ -88,7 +88,7 @@ impl ItemScope {
88 } 88 }
89 } 89 }
90 90
91 pub fn traits<'a>(&'a self) -> impl Iterator<Item = TraitId> + 'a { 91 pub(crate) fn traits<'a>(&'a self) -> impl Iterator<Item = TraitId> + 'a {
92 self.items.values().filter_map(|r| match r.def.take_types() { 92 self.items.values().filter_map(|r| match r.def.take_types() {
93 Some(ModuleDefId::TraitId(t)) => Some(t), 93 Some(ModuleDefId::TraitId(t)) => Some(t),
94 _ => None, 94 _ => None,