Specify vector capacity on surround_add
This commit is contained in:
parent
1a1685acf7
commit
2c1313c064
1 changed files with 1 additions and 1 deletions
|
@ -4698,7 +4698,7 @@ fn surround_add(cx: &mut Context) {
|
||||||
let selection = doc.selection(view.id);
|
let selection = doc.selection(view.id);
|
||||||
let (open, close) = surround::get_pair(ch);
|
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() {
|
for range in selection.iter() {
|
||||||
changes.push((range.from(), range.from(), Some(Tendril::from_char(open))));
|
changes.push((range.from(), range.from(), Some(Tendril::from_char(open))));
|
||||||
changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));
|
changes.push((range.to(), range.to(), Some(Tendril::from_char(close))));
|
||||||
|
|
Loading…
Reference in a new issue