From 1a565872d7c784bc798340617a3677cca20ed7b7 Mon Sep 17 00:00:00 2001 From: Denis Drakhnia Date: Tue, 17 Oct 2023 14:12:32 +0300 Subject: [PATCH] Remove unnecessary unsafe --- protocol/src/cursor.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol/src/cursor.rs b/protocol/src/cursor.rs index a5d1f0d..825b74a 100644 --- a/protocol/src/cursor.rs +++ b/protocol/src/cursor.rs @@ -322,9 +322,10 @@ macro_rules! impl_put { impl<'a> CursorMut<'a> { pub fn new(buffer: &'a mut [u8]) -> Self { + let (buffer, buffer_mut) = buffer.split_at_mut(0); Self { - buffer: unsafe { slice::from_raw_parts(buffer.as_ptr(), 0) }, - buffer_mut: buffer, + buffer, + buffer_mut, } }