shrink_to_fit body source map
This commit is contained in:
parent
8f5fee4a5a
commit
cfcef69072
@ -166,9 +166,10 @@ pub(crate) fn body_with_source_map_query(
|
|||||||
};
|
};
|
||||||
let module = def.module(db);
|
let module = def.module(db);
|
||||||
let expander = Expander::new(db, file_id, module);
|
let expander = Expander::new(db, file_id, module);
|
||||||
let (mut body, source_map) =
|
let (mut body, mut source_map) =
|
||||||
Body::new(db, def, expander, params, body, module.krate, is_async_fn);
|
Body::new(db, def, expander, params, body, module.krate, is_async_fn);
|
||||||
body.shrink_to_fit();
|
body.shrink_to_fit();
|
||||||
|
source_map.shrink_to_fit();
|
||||||
|
|
||||||
(Arc::new(body), Arc::new(source_map))
|
(Arc::new(body), Arc::new(source_map))
|
||||||
}
|
}
|
||||||
@ -390,4 +391,29 @@ pub fn macro_expansion_expr(&self, node: InFile<&ast::MacroExpr>) -> Option<Expr
|
|||||||
pub fn diagnostics(&self) -> &[BodyDiagnostic] {
|
pub fn diagnostics(&self) -> &[BodyDiagnostic] {
|
||||||
&self.diagnostics
|
&self.diagnostics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn shrink_to_fit(&mut self) {
|
||||||
|
let Self {
|
||||||
|
expr_map,
|
||||||
|
expr_map_back,
|
||||||
|
pat_map,
|
||||||
|
pat_map_back,
|
||||||
|
label_map,
|
||||||
|
label_map_back,
|
||||||
|
field_map_back,
|
||||||
|
pat_field_map_back,
|
||||||
|
expansions,
|
||||||
|
diagnostics,
|
||||||
|
} = self;
|
||||||
|
expr_map.shrink_to_fit();
|
||||||
|
expr_map_back.shrink_to_fit();
|
||||||
|
pat_map.shrink_to_fit();
|
||||||
|
pat_map_back.shrink_to_fit();
|
||||||
|
label_map.shrink_to_fit();
|
||||||
|
label_map_back.shrink_to_fit();
|
||||||
|
field_map_back.shrink_to_fit();
|
||||||
|
pat_field_map_back.shrink_to_fit();
|
||||||
|
expansions.shrink_to_fit();
|
||||||
|
diagnostics.shrink_to_fit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ fn collect_import_map(db: &dyn DefDatabase, krate: CrateId) -> FxIndexMap<ItemIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
map.shrink_to_fit();
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user