From d4ddec2bdfc0766782a662b87e1456a9041e8182 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 24 Jun 2020 16:14:58 +0200 Subject: Shrink arenas after building ItemTree --- crates/ra_arena/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/ra_arena/src') diff --git a/crates/ra_arena/src/lib.rs b/crates/ra_arena/src/lib.rs index 441fbb3cb..3169aa5b8 100644 --- a/crates/ra_arena/src/lib.rs +++ b/crates/ra_arena/src/lib.rs @@ -116,6 +116,9 @@ impl Arena { ) -> impl Iterator, &T)> + ExactSizeIterator + DoubleEndedIterator { self.data.iter().enumerate().map(|(idx, value)| (Idx::from_raw(RawId(idx as u32)), value)) } + pub fn shrink_to_fit(&mut self) { + self.data.shrink_to_fit(); + } } impl Default for Arena { -- cgit v1.2.3