From 4f8d89bc35341f4b096a89f8c8850932276d7b71 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Sat, 16 Sep 2023 09:41:20 +0200 Subject: Update dependencies --- src/mnemonic/wordlist.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/mnemonic/wordlist.rs') diff --git a/src/mnemonic/wordlist.rs b/src/mnemonic/wordlist.rs index 702f745..0e472ee 100644 --- a/src/mnemonic/wordlist.rs +++ b/src/mnemonic/wordlist.rs @@ -1,7 +1,7 @@ //! Module containing the embedded BIP-0039 word lists. use crate::mnemonic::Language; -use std::{mem::MaybeUninit, sync::Once}; +use std::sync::OnceLock; /// A parsed word list. pub struct Wordlist<'a>(Vec<&'a str>); @@ -52,16 +52,10 @@ macro_rules! match_language { )*) => {$( match $lang { Language::$l => { - static mut WORDLIST: MaybeUninit = MaybeUninit::uninit(); - static INIT: Once = Once::new(); - INIT.call_once(|| { - unsafe { - WORDLIST.as_mut_ptr().write(Wordlist::parse( - include_str!(concat!("wordlist/", $f)), - )) - } - }); - unsafe { &*WORDLIST.as_ptr() } + static WORDLIST: OnceLock = OnceLock::new(); + WORDLIST.get_or_init(|| { + Wordlist::parse(include_str!(concat!("wordlist/", $f))) + }) } } )*}; -- cgit v1.2.3