diff --git a/crates/ra_tt/src/buffer.rs b/crates/ra_tt/src/buffer.rs index 14b3f707df..5967f44cd0 100644 --- a/crates/ra_tt/src/buffer.rs +++ b/crates/ra_tt/src/buffer.rs @@ -42,7 +42,9 @@ impl<'t> TokenBuffer<'t> { buffers: &mut Vec]>>, next: Option, ) -> usize { - let mut entries = vec![]; + // Must contain everything in tokens and then the Entry::End + let start_capacity = tokens.len() + 1; + let mut entries = Vec::with_capacity(start_capacity); let mut children = vec![]; for (idx, tt) in tokens.iter().enumerate() {