Skip to content

Commit 567cd52

Browse files
committed
move self-replacement to separate line
1 parent 5e6abf1 commit 567cd52

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/alloc/src/vec.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2412,12 +2412,13 @@ impl<T> SpecExtend<T, IntoIter<T>> for Vec<T> {
24122412
{
24132413
// Safety: we just checked that IntoIter has sufficient capacity to prepend our elements.
24142414
// Prepending will then fill the uninitialized prefix.
2415-
*self = unsafe {
2415+
let v = unsafe {
24162416
let mut v = iterator.into_vec_with_uninit_prefix(self.len() as isize);
24172417
ptr::copy_nonoverlapping(self.as_ptr(), v.as_mut_ptr(), self.len);
24182418
self.set_len(0);
24192419
v
24202420
};
2421+
*self = v;
24212422
return;
24222423
}
24232424
iterator.move_into(self);

0 commit comments

Comments
 (0)