Make public DefMap fields private

This commit is contained in:
Jonas Schievink 2021-01-20 15:41:18 +01:00
parent de5aabd48b
commit 0587b99fde
10 changed files with 31 additions and 23 deletions

View file

@ -409,7 +409,7 @@ mod tests {
let crate_def_map = self.crate_def_map(krate);
let mut fns = Vec::new();
for (module_id, _) in crate_def_map.modules.iter() {
for (module_id, _) in crate_def_map.modules() {
for decl in crate_def_map[module_id].scope.declarations() {
let mut sink = DiagnosticSinkBuilder::new().build(&mut cb);
validate_module_item(self, krate, decl, &mut sink);

View file

@ -112,7 +112,7 @@ impl TraitImpls {
let mut impls = Self { map: FxHashMap::default() };
let crate_def_map = db.crate_def_map(krate);
for (_module_id, module_data) in crate_def_map.modules.iter() {
for (_module_id, module_data) in crate_def_map.modules() {
for impl_id in module_data.scope.impls() {
let target_trait = match db.impl_trait(impl_id) {
Some(tr) => tr.value.trait_,
@ -198,7 +198,7 @@ impl InherentImpls {
let mut map: FxHashMap<_, Vec<_>> = FxHashMap::default();
let crate_def_map = db.crate_def_map(krate);
for (_module_id, module_data) in crate_def_map.modules.iter() {
for (_module_id, module_data) in crate_def_map.modules() {
for impl_id in module_data.scope.impls() {
let data = db.impl_data(impl_id);
if data.target_trait.is_some() {

View file

@ -81,7 +81,7 @@ impl TestDB {
pub(crate) fn module_for_file(&self, file_id: FileId) -> ModuleId {
for &krate in self.relevant_crates(file_id).iter() {
let crate_def_map = self.crate_def_map(krate);
for (local_id, data) in crate_def_map.modules.iter() {
for (local_id, data) in crate_def_map.modules() {
if data.origin.file_id() == Some(file_id) {
return ModuleId { krate, local_id };
}
@ -95,7 +95,7 @@ impl TestDB {
let crate_graph = self.crate_graph();
for krate in crate_graph.iter() {
let crate_def_map = self.crate_def_map(krate);
for (module_id, _) in crate_def_map.modules.iter() {
for (module_id, _) in crate_def_map.modules() {
let file_id = crate_def_map[module_id].origin.file_id();
files.extend(file_id)
}