Fix one use of MaybeUninit (#291)

This commit is contained in:
Taiki Endo
2019-09-01 01:33:10 +09:00
committed by GitHub
parent 425432ba6c
commit 73426dfaa3
+3 -4
View File
@@ -2176,19 +2176,18 @@ impl Inner {
if self.is_inline_or_static() {
// In this case, a shallow_clone still involves copying the data.
let mut inner: Inner = mem::MaybeUninit::uninit().assume_init();
let mut inner: mem::MaybeUninit<Inner> = mem::MaybeUninit::uninit();
ptr::copy_nonoverlapping(
self,
&mut inner,
inner.as_mut_ptr(),
1,
);
inner
inner.assume_init()
} else {
self.shallow_clone_sync(mut_self)
}
}
#[cold]
unsafe fn shallow_clone_sync(&self, mut_self: bool) -> Inner {
// The function requires `&self`, this means that `shallow_clone`