mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
Fix one use of MaybeUninit (#291)
This commit is contained in:
+3
-4
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user