Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi committed May 28, 2024
1 parent fd20dae commit 5973438
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/src/new_uninit_slice.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use alloc::alloc::alloc;
use core::{alloc::Layout, mem::MaybeUninit};
use core::{alloc::Layout, mem::MaybeUninit, slice};

use crate::prelude::*;

// TODO: use `Box::new_uninit_slice` once stabilized
// https://github.com/rust-lang/rust/issues/63291
pub fn new_uninit_slice<T>(len: usize) -> Box<[MaybeUninit<T>]> {
unsafe { Box::from_raw(core::slice::from_raw_parts_mut(alloc(Layout::array::<T>(len).unwrap()).cast(), len)) }
unsafe { Box::from_raw(slice::from_raw_parts_mut(alloc(Layout::array::<T>(len).unwrap()).cast(), len)) }
}

0 comments on commit 5973438

Please sign in to comment.