Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Remove warning about mem::uninitialized.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdm committed Sep 10, 2019
1 parent 1c04111 commit 7ccc50f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rust-webvr-api/src/vr_frame_data.rs
Expand Up @@ -53,12 +53,11 @@ impl VRFrameData {

pub fn from_bytes(bytes: &[u8]) -> VRFrameData {
unsafe {
let mut result: VRFrameData = mem::uninitialized();
let mut result = mem::MaybeUninit::uninit();
ptr::copy_nonoverlapping(bytes.as_ptr(),
&mut result as *mut VRFrameData as *mut u8,
result.as_mut_ptr() as *mut u8,
mem::size_of::<VRFrameData>());

result
result.assume_init()
}
}
}

0 comments on commit 7ccc50f

Please sign in to comment.