Provide a capacity on Selection::new's normalize.

imgbot
Blaž Hrastnik 3 years ago
parent df306fe031
commit bd607b4cbd

@ -214,7 +214,7 @@ impl Selection {
ranges.sort_unstable_by_key(Range::from);
primary_index = ranges.iter().position(|&range| range == primary).unwrap();
let mut result = SmallVec::new();
let mut result = SmallVec::with_capacity(ranges.len()); // approx
// TODO: we could do with one vec by removing elements as we mutate

Loading…
Cancel
Save