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

This commit is contained in:
Blaž Hrastnik 2021-03-22 14:50:08 +09:00
parent df306fe031
commit bd607b4cbd

View file

@ -214,7 +214,7 @@ pub fn point(pos: usize) -> Self {
ranges.sort_unstable_by_key(Range::from); ranges.sort_unstable_by_key(Range::from);
primary_index = ranges.iter().position(|&range| range == primary).unwrap(); 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 // TODO: we could do with one vec by removing elements as we mutate