From 6a41e58e7589a8f8fec4da016a9aa9946d78e7ff Mon Sep 17 00:00:00 2001 From: Joshua Simmons Date: Thu, 8 Sep 2022 18:55:24 +0200 Subject: [PATCH] Switch thread token to `std::array::from_fn` --- narcissus-core/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/narcissus-core/src/lib.rs b/narcissus-core/src/lib.rs index 180c757..3c50605 100644 --- a/narcissus-core/src/lib.rs +++ b/narcissus-core/src/lib.rs @@ -73,12 +73,8 @@ macro_rules! thread_token_def { where F: FnMut() -> T, { - let mut slots = uninit_array(); - for elem in &mut slots[..] { - elem.write(UnsafeCell::new(f())); - } Self { - slots: unsafe { array_assume_init(slots) }, + slots: std::array::from_fn(|_| UnsafeCell::new(f())), } } -- 2.49.0