From f73c6c8e8543ee15741c788d105e2b4235f1bc7b Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Thu, 28 Dec 2023 06:17:53 +0100 Subject: [PATCH] Simplify UninitSlice::as_uninit_slice_mut() logic (#644) This reworks `UninitSlice::as_uninit_slice_mut()` using equivalent simpler logic. --- src/buf/uninit_slice.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buf/uninit_slice.rs b/src/buf/uninit_slice.rs index 0715ad233..82ebdbbb3 100644 --- a/src/buf/uninit_slice.rs +++ b/src/buf/uninit_slice.rs @@ -185,7 +185,7 @@ impl UninitSlice { /// ``` #[inline] pub unsafe fn as_uninit_slice_mut(&mut self) -> &mut [MaybeUninit] { - &mut *(self as *mut _ as *mut [MaybeUninit]) + &mut self.0 } /// Returns the number of bytes in the slice.