mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 17:18:32 +03:00
make stuff private
This commit is contained in:
@@ -153,17 +153,10 @@ pub(crate) fn modules<'a>(&'a self) -> impl Iterator<Item = ModuleId> + 'a {
|
||||
self.mods.iter().map(|(id, _)| id)
|
||||
}
|
||||
|
||||
fn modules_for_source(&self, source: ModuleSource) -> Vec<ModuleId> {
|
||||
self.mods
|
||||
.iter()
|
||||
.filter(|(_idx, it)| it.source == source)
|
||||
.map(|(idx, _)| idx)
|
||||
.collect()
|
||||
}
|
||||
|
||||
//TODO: move to source binders?
|
||||
pub(crate) fn any_module_for_source(&self, source: ModuleSource) -> Option<ModuleId> {
|
||||
self.modules_for_source(source).pop()
|
||||
pub(crate) fn modules_with_sources<'a>(
|
||||
&'a self,
|
||||
) -> impl Iterator<Item = (ModuleId, ModuleSource)> + 'a {
|
||||
self.mods.iter().map(|(id, m)| (id, m.source))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,10 @@ fn module_from_source(
|
||||
) -> Cancelable<Option<Module>> {
|
||||
let source_root_id = db.file_source_root(module_source.file_id());
|
||||
let module_tree = db.module_tree(source_root_id)?;
|
||||
|
||||
let module_id = ctry!(module_tree.any_module_for_source(module_source));
|
||||
let m = module_tree
|
||||
.modules_with_sources()
|
||||
.find(|(_id, src)| src == &module_source);
|
||||
let module_id = ctry!(m).0;
|
||||
Ok(Some(Module::new(db, source_root_id, module_id)?))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user