aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src')
-rw-r--r--crates/hir_def/src/item_scope.rs11
-rw-r--r--crates/hir_def/src/nameres.rs11
-rw-r--r--crates/hir_def/src/nameres/collector.rs4
3 files changed, 25 insertions, 1 deletions
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs
index f3ebe7c72..4ddfd9ee6 100644
--- a/crates/hir_def/src/item_scope.rs
+++ b/crates/hir_def/src/item_scope.rs
@@ -285,6 +285,17 @@ impl ItemScope {
285 buf.push('\n'); 285 buf.push('\n');
286 } 286 }
287 } 287 }
288
289 pub(crate) fn shrink_to_fit(&mut self) {
290 self.types.shrink_to_fit();
291 self.values.shrink_to_fit();
292 self.macros.shrink_to_fit();
293 self.unresolved.shrink_to_fit();
294 self.defs.shrink_to_fit();
295 self.impls.shrink_to_fit();
296 self.unnamed_trait_imports.shrink_to_fit();
297 self.legacy_macros.shrink_to_fit();
298 }
288} 299}
289 300
290impl PerNs { 301impl PerNs {
diff --git a/crates/hir_def/src/nameres.rs b/crates/hir_def/src/nameres.rs
index 9e8e4e9ec..6a09ad420 100644
--- a/crates/hir_def/src/nameres.rs
+++ b/crates/hir_def/src/nameres.rs
@@ -409,6 +409,17 @@ impl DefMap {
409 } 409 }
410 } 410 }
411 } 411 }
412
413 fn shrink_to_fit(&mut self) {
414 self.extern_prelude.shrink_to_fit();
415 self.exported_proc_macros.shrink_to_fit();
416 self.diagnostics.shrink_to_fit();
417 self.modules.shrink_to_fit();
418 for (_, module) in self.modules.iter_mut() {
419 module.children.shrink_to_fit();
420 module.scope.shrink_to_fit();
421 }
422 }
412} 423}
413 424
414impl ModuleData { 425impl ModuleData {
diff --git a/crates/hir_def/src/nameres/collector.rs b/crates/hir_def/src/nameres/collector.rs
index c2e445b68..4ddc791ce 100644
--- a/crates/hir_def/src/nameres/collector.rs
+++ b/crates/hir_def/src/nameres/collector.rs
@@ -109,7 +109,9 @@ pub(super) fn collect_defs(
109 } 109 }
110 } 110 }
111 collector.collect(); 111 collector.collect();
112 collector.finish() 112 let mut def_map = collector.finish();
113 def_map.shrink_to_fit();
114 def_map
113} 115}
114 116
115#[derive(Copy, Clone, Debug, Eq, PartialEq)] 117#[derive(Copy, Clone, Debug, Eq, PartialEq)]