Specify capacity on toggle_line_comments
commit82ff5b0ab6fd620a23744ffa514ce7a82900ca02
authorBlaž Hrastnik <blaz@mxxn.io>
dateSat 6 Nov 2021, 23:57 (5 years ago)
parent4010b32
helix-core/src/comment.rs+1−1
@@ -63,7 +63,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&st
6363 let token = token.unwrap_or("//");
6464 let comment = Tendril::from(format!("{} ", token));
6565
66− let mut lines: Vec<usize> = Vec::new();
66+ let mut lines: Vec<usize> = Vec::with_capacity(selection.len());
6767
6868 let mut min_next_line = 0;
6969 for selection in selection {