diff --git a/lib.rs b/lib.rs index 37723d6..64e4985 100644 --- a/lib.rs +++ b/lib.rs @@ -574,7 +574,7 @@ impl SmallVec { unsafe { let (_, &mut len, cap) = self.triple_mut(); if len == cap { - self.grow(cmp::max(cap * 2, 1)) + self.reserve(1); } let (ptr, len_ptr, _) = self.triple_mut(); *len_ptr = len + 1; @@ -632,6 +632,7 @@ impl SmallVec { /// If the new capacity would overflow `usize` then it will be set to `usize::max_value()` /// instead. (This means that inserting `additional` new elements is not guaranteed to be /// possible after calling this function.) + #[inline] pub fn reserve(&mut self, additional: usize) { // prefer triple_mut() even if triple() would work // so that the optimizer removes duplicated calls to it