From 2c1313c0648977540c395de584b4293c1909cbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sat, 6 Nov 2021 23:52:49 +0900 Subject: [PATCH] Specify vector capacity on surround_add --- helix-term/src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index f2a1e66d..80cbd6d2 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -4698,7 +4698,7 @@ fn surround_add(cx: &mut Context) { let selection = doc.selection(view.id); let (open, close) = surround::get_pair(ch); - let mut changes = Vec::new(); + let mut changes = Vec::with_capacity(selection.len() * 2); for range in selection.iter() { changes.push((range.from(), range.from(), Some(Tendril::from_char(open)))); changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));