mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Remove ModuleId
from hir
reexports
This commit is contained in:
parent
16d3a7bf08
commit
18e80e6892
4 changed files with 50 additions and 44 deletions
|
@ -49,7 +49,7 @@ use hir_def::{
|
|||
src::HasSource as _,
|
||||
AdtId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, ConstParamId, DefWithBodyId, EnumId,
|
||||
FunctionId, GenericDefId, HasModule, ImplId, ItemContainerId, LifetimeParamId,
|
||||
LocalEnumVariantId, LocalFieldId, Lookup, StaticId, StructId, TraitId, TypeAliasId,
|
||||
LocalEnumVariantId, LocalFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId,
|
||||
TypeParamId, UnionId,
|
||||
};
|
||||
use hir_expand::{name::name, MacroCallKind, MacroDefKind};
|
||||
|
@ -115,7 +115,6 @@ pub use {
|
|||
path::{ModPath, PathKind},
|
||||
type_ref::{Mutability, TypeRef},
|
||||
visibility::Visibility,
|
||||
ModuleId,
|
||||
},
|
||||
hir_expand::{
|
||||
name::{known, Name},
|
||||
|
@ -183,6 +182,11 @@ impl Crate {
|
|||
Module { id: def_map.module_id(def_map.root()) }
|
||||
}
|
||||
|
||||
pub fn modules(self, db: &dyn HirDatabase) -> Vec<Module> {
|
||||
let def_map = db.crate_def_map(self.id);
|
||||
def_map.modules().map(|(id, _)| def_map.module_id(id).into()).collect()
|
||||
}
|
||||
|
||||
pub fn root_file(self, db: &dyn HirDatabase) -> FileId {
|
||||
db.crate_graph()[self.id].root_file_id
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue