on master help sign in
Specify capacity on toggle_line_comments
82ff5b0Blaž Hrastnik
helix-core/src/comment.rs+1−1
@@ -63,7 +63,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&st
63 let token = token.unwrap_or("//");
63 let token = token.unwrap_or("//");
64 let comment = Tendril::from(format!("{} ", token));
64 let comment = Tendril::from(format!("{} ", token));
65
65
66− let mut lines: Vec<usize> = Vec::new();
66+ let mut lines: Vec<usize> = Vec::with_capacity(selection.len());
67
67
68 let mut min_next_line = 0;
68 let mut min_next_line = 0;
69 for selection in selection {
69 for selection in selection {