on master help sign in
Specify vector capacity on surround_add
commit2c1313c0648977540c395de584b4293c1909cbf7 authorBlaž Hrastnik <blaz@mxxn.io> dateSat 6 Nov 2021, 23:52 (5 years ago) parent1a1685a
1 file changed+1−1
helix-term/src/commands.rs+1−1
helix-term/src/commands.rs+1−1
@@ -4698,7 +4698,7 @@ fn surround_add(cx: &mut Context) {
46984698 let selection = doc.selection(view.id);
46994699 let (open, close) = surround::get_pair(ch);
47004700
4701− let mut changes = Vec::new();
4701+ let mut changes = Vec::with_capacity(selection.len() * 2);
47024702 for range in selection.iter() {
47034703 changes.push((range.from(), range.from(), Some(Tendril::from_char(open))));
47044704 changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));