Skip to content

Commit 2e84514

Browse files
committed
improve headervec drop() by dropping the elements as slice
1 parent 156cb39 commit 2e84514

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,8 @@ impl<H, T> HeaderVec<H, T> {
950950
impl<H, T> Drop for HeaderVec<H, T> {
951951
fn drop(&mut self) {
952952
unsafe {
953+
ptr::drop_in_place(self.as_mut_slice());
953954
ptr::drop_in_place(&mut self.header_mut().head);
954-
for ix in 0..self.len_exact() {
955-
ptr::drop_in_place(self.as_mut_ptr().add(ix));
956-
}
957955
alloc::alloc::dealloc(self.ptr() as *mut u8, Self::layout(self.capacity()));
958956
}
959957
}

0 commit comments

Comments
 (0)