From ea864155848387f01a607ac36563449e81e4f140 Mon Sep 17 00:00:00 2001 From: marc0246 <40955683+marc0246@users.noreply.github.com> Date: Sat, 29 Apr 2023 14:12:42 +0200 Subject: [PATCH] Remove needless `unsafe` from `Buffer::from_{data,iter}` (#2196) --- vulkano/src/buffer/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vulkano/src/buffer/mod.rs b/vulkano/src/buffer/mod.rs index 3b281b70bc..7a579811d5 100644 --- a/vulkano/src/buffer/mod.rs +++ b/vulkano/src/buffer/mod.rs @@ -134,7 +134,6 @@ use std::{ hash::{Hash, Hasher}, mem::size_of_val, ops::Range, - ptr, sync::Arc, }; @@ -280,7 +279,7 @@ impl Buffer { { let buffer = Buffer::new_sized(allocator, buffer_info, allocation_info)?; - unsafe { ptr::write(&mut *buffer.write()?, data) }; + *buffer.write()? = data; Ok(buffer) } @@ -317,7 +316,7 @@ impl Buffer { )?; for (o, i) in buffer.write()?.iter_mut().zip(iter) { - unsafe { ptr::write(o, i) }; + *o = i; } Ok(buffer)