From: Joshua Simmons Date: Thu, 8 Sep 2022 16:55:24 +0000 (+0200) Subject: Switch thread token to `std::array::from_fn` X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=6a41e58e7589a8f8fec4da016a9aa9946d78e7ff;p=josh%2Fnarcissus Switch thread token to `std::array::from_fn` --- 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())), } }