1
Fork 0

Remove special-case handling of vec.split_off(0)

This commit is contained in:
Zalathar 2024-01-13 17:12:15 +11:00
parent 89110dafe7
commit a655558b38
2 changed files with 18 additions and 14 deletions

View file

@ -2195,14 +2195,6 @@ impl<T, A: Allocator> Vec<T, A> {
assert_failed(at, self.len());
}
if at == 0 {
// the new vector can take over the original buffer and avoid the copy
return mem::replace(
self,
Vec::with_capacity_in(self.capacity(), self.allocator().clone()),
);
}
let other_len = self.len - at;
let mut other = Vec::with_capacity_in(other_len, self.allocator().clone());