We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 88b62b6 + 4ba0d0f commit c20cfa8Copy full SHA for c20cfa8
lib.rs
@@ -665,6 +665,8 @@ impl<A: Array> SmallVec<A> {
665
if unspilled {
666
return;
667
}
668
+ } else {
669
+ return;
670
671
deallocate(ptr, cap);
672
@@ -2341,4 +2343,18 @@ mod tests {
2341
2343
v.extend(it);
2342
2344
assert_eq!(v[..], ['a']);
2345
2346
+
2347
+ #[test]
2348
+ fn grow_spilled_same_size() {
2349
+ let mut v: SmallVec<[u8; 2]> = SmallVec::new();
2350
+ v.push(0);
2351
+ v.push(1);
2352
+ v.push(2);
2353
+ assert!(v.spilled());
2354
+ assert_eq!(v.capacity(), 4);
2355
+ // grow with the same capacity
2356
+ v.grow(4);
2357
2358
+ assert_eq!(v[..], [0, 1, 2]);
2359
+ }
2360
0 commit comments