aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r--crates/ra_hir_def/src/item_scope.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs
index 5e943b780..ef1aaba6f 100644
--- a/crates/ra_hir_def/src/item_scope.rs
+++ b/crates/ra_hir_def/src/item_scope.rs
@@ -68,6 +68,12 @@ impl ItemScope {
68 self.impls.iter().copied() 68 self.impls.iter().copied()
69 } 69 }
70 70
71 pub fn visbility_of(&self, def: ModuleDefId) -> Option<Visibility> {
72 self.name_of(ItemInNs::Types(def))
73 .or_else(|| self.name_of(ItemInNs::Values(def)))
74 .map(|(_, v)| v)
75 }
76
71 /// Iterate over all module scoped macros 77 /// Iterate over all module scoped macros
72 pub(crate) fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a { 78 pub(crate) fn macros<'a>(&'a self) -> impl Iterator<Item = (&'a Name, MacroDefId)> + 'a {
73 self.visible.iter().filter_map(|(name, def)| def.take_macros().map(|macro_| (name, macro_))) 79 self.visible.iter().filter_map(|(name, def)| def.take_macros().map(|macro_| (name, macro_)))