Set the capacity of the Vec used in gather_captures() to the number of captures expected

This commit is contained in:
Devyn Cairns 2024-07-10 17:31:42 -07:00
parent ea8c4e3af2
commit 9354d358fd

View File

@ -262,7 +262,7 @@ impl Stack {
} }
pub fn gather_captures(&self, engine_state: &EngineState, captures: &[VarId]) -> Stack { pub fn gather_captures(&self, engine_state: &EngineState, captures: &[VarId]) -> Stack {
let mut vars = vec![]; let mut vars = Vec::with_capacity(captures.len());
let fake_span = Span::new(0, 0); let fake_span = Span::new(0, 0);