Preallocate parser::Input

This commit is contained in:
Chayim Refael Friedman 2025-04-25 17:18:14 +03:00
parent 5ff4ba347d
commit 8bff414abc
3 changed files with 10 additions and 3 deletions

View file

@ -12,7 +12,7 @@ pub fn to_parser_input<Ctx: Copy + fmt::Debug + PartialEq + Eq + Hash>(
buffer: tt::TokenTreesView<'_, SpanData<Ctx>>,
span_to_edition: &mut dyn FnMut(Ctx) -> Edition,
) -> parser::Input {
let mut res = parser::Input::default();
let mut res = parser::Input::with_capacity(buffer.len());
let mut current = buffer.cursor();
let mut syntax_context_to_edition_cache = FxHashMap::default();