From 0587b99fde4acf4225c024980dbde624ce6821e6 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 20 Jan 2021 15:41:18 +0100 Subject: Make public DefMap fields private --- crates/hir_ty/src/diagnostics.rs | 2 +- crates/hir_ty/src/method_resolution.rs | 4 ++-- crates/hir_ty/src/test_db.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/diagnostics.rs b/crates/hir_ty/src/diagnostics.rs index c67a289f2..247da43f2 100644 --- a/crates/hir_ty/src/diagnostics.rs +++ b/crates/hir_ty/src/diagnostics.rs @@ -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); diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index 8a289f52a..f06aeeb42 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs @@ -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() { diff --git a/crates/hir_ty/src/test_db.rs b/crates/hir_ty/src/test_db.rs index 646e16bbe..3bbcbc242 100644 --- a/crates/hir_ty/src/test_db.rs +++ b/crates/hir_ty/src/test_db.rs @@ -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) } -- cgit v1.2.3