mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Reduce reallocations in ra_tt::buffer::TokenBuffer::new_inner
This commit is contained in:
parent
ef6d53521f
commit
b606399095
1 changed files with 3 additions and 1 deletions
|
@ -42,7 +42,9 @@ impl<'t> TokenBuffer<'t> {
|
|||
buffers: &mut Vec<Box<[Entry<'t>]>>,
|
||||
next: Option<EntryPtr>,
|
||||
) -> 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() {
|
||||
|
|
Loading…
Reference in a new issue