From fa7f9d696f5863dbf28b3d0ef14c1bc9143b2d21 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 13 Jan 2019 11:58:41 +0100 Subject: Make Module impl methods crate-private, update some comments --- crates/ra_hir/src/code_model_impl/module.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/code_model_impl') diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 2014f1090..73c212de8 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -95,7 +95,7 @@ impl Module { } /// Finds a child module with the specified name. - pub fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option { + pub(crate) fn child_impl(&self, db: &impl HirDatabase, name: &Name) -> Option { let loc = self.def_id.loc(db); let module_tree = db.module_tree(loc.source_root_id); let child_id = loc.module_id.child(&module_tree, name)?; @@ -103,7 +103,7 @@ impl Module { } /// Iterates over all child modules. - pub fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator { + pub(crate) fn children_impl(&self, db: &impl HirDatabase) -> impl Iterator { // FIXME this should be implementable without collecting into a vec, but // it's kind of hard since the iterator needs to keep a reference to the // module tree. @@ -117,7 +117,7 @@ impl Module { children.into_iter() } - pub fn parent_impl(&self, db: &impl HirDatabase) -> Option { + pub(crate) fn parent_impl(&self, db: &impl HirDatabase) -> Option { let loc = self.def_id.loc(db); let module_tree = db.module_tree(loc.source_root_id); let parent_id = loc.module_id.parent(&module_tree)?; @@ -125,13 +125,13 @@ impl Module { } /// Returns a `ModuleScope`: a set of items, visible in this module. - pub fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope { + pub(crate) fn scope_impl(&self, db: &impl HirDatabase) -> ModuleScope { let loc = self.def_id.loc(db); let item_map = db.item_map(loc.source_root_id); item_map.per_module[&loc.module_id].clone() } - pub fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs { + pub(crate) fn resolve_path_impl(&self, db: &impl HirDatabase, path: &Path) -> PerNs { let mut curr_per_ns = PerNs::types( match path.kind { PathKind::Crate => self.crate_root(db), @@ -191,7 +191,10 @@ impl Module { curr_per_ns } - pub fn problems_impl(&self, db: &impl HirDatabase) -> Vec<(TreeArc, Problem)> { + pub(crate) fn problems_impl( + &self, + db: &impl HirDatabase, + ) -> Vec<(TreeArc, Problem)> { let loc = self.def_id.loc(db); let module_tree = db.module_tree(loc.source_root_id); loc.module_id.problems(&module_tree, db) -- cgit v1.2.3