Skip to content

Commit d88b2d9

Browse files
author
bors-servo
authored
Auto merge of #100 - mbrubeck:drop, r=SimonSapin
Use a single ptr::drop_in_place call instead of a loop This is what the standard Vec does; see rust-lang/rust#32012. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/100) <!-- Reviewable:end -->
2 parents 73b24b4 + b24b3d2 commit d88b2d9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,10 +1186,7 @@ impl<A: Array> Drop for SmallVec<A> {
11861186
let (ptr, len) = self.data.heap();
11871187
Vec::from_raw_parts(ptr, len, self.capacity);
11881188
} else {
1189-
let ptr = self.as_mut_ptr();
1190-
for i in 0..self.len() {
1191-
ptr::drop_in_place(ptr.offset(i as isize));
1192-
}
1189+
ptr::drop_in_place(&mut self[..]);
11931190
}
11941191
}
11951192
}

0 commit comments

Comments
 (0)