From 6d81471012dcb3e57499f2e556f97be46f736ce3 Mon Sep 17 00:00:00 2001 From: peamaeq Date: Wed, 4 May 2022 09:21:20 +0800 Subject: [PATCH] 0503 --- atom/src/vector.rs | 6 +++--- urid/src/lib.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/atom/src/vector.rs b/atom/src/vector.rs index 10643fd2..1b901093 100644 --- a/atom/src/vector.rs +++ b/atom/src/vector.rs @@ -127,12 +127,12 @@ impl<'a, 'b, A: ScalarAtom> VectorWriter<'a, 'b, A> { }; self.frame .allocate(raw_data.len(), false) - .map(|(_, space)| unsafe { + .map(|(_, space)| { space.copy_from_slice(raw_data); - std::slice::from_raw_parts_mut( + unsafe { std::slice::from_raw_parts_mut( space.as_mut_ptr() as *mut A::InternalType, data.len(), - ) + ) } }) } } diff --git a/urid/src/lib.rs b/urid/src/lib.rs index 77eb7f5c..d925f15a 100644 --- a/urid/src/lib.rs +++ b/urid/src/lib.rs @@ -384,12 +384,12 @@ impl Unmap for HashURIDMapper { // This is safe because the only way this reference might become invalid is if an // entry gets overwritten, which is not something that we allow through this // interface. - return Some(unsafe { + return Some({ let bytes = uri.as_bytes_with_nul(); - Uri::from_bytes_with_nul_unchecked(std::slice::from_raw_parts( + unsafe { Uri::from_bytes_with_nul_unchecked(std::slice::from_raw_parts( bytes.as_ptr(), bytes.len(), - )) + )) } }); } }