shrink_to_fit() in more places

This saves 18mb on `analysis-stats .`, without regressing speed.
This commit is contained in:
Chayim Refael Friedman 2025-04-25 09:40:53 +03:00
parent 5ff4ba347d
commit 1fe060719a
8 changed files with 51 additions and 27 deletions

View file

@ -223,7 +223,10 @@ impl ItemTree {
}
fn shrink_to_fit(&mut self) {
if let Some(data) = &mut self.data {
let ItemTree { top_level, attrs, data } = self;
top_level.shrink_to_fit();
attrs.shrink_to_fit();
if let Some(data) = data {
let ItemTreeData {
uses,
extern_crates,