Skip to content

Commit ad57885

Browse files
committed
Remove more direct use of OnceCell
1 parent ec09599 commit ad57885

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

stdlib/src/uuid.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub(crate) use _uuid::make_module;
44
mod _uuid {
55
use crate::{builtins::PyNone, vm::VirtualMachine};
66
use mac_address::get_mac_address;
7-
use once_cell::sync::OnceCell;
7+
use std::sync::OnceLock;
88
use uuid::{Context, Uuid, timestamp::Timestamp};
99

1010
fn get_node_id() -> [u8; 6] {
@@ -19,7 +19,7 @@ mod _uuid {
1919
static CONTEXT: Context = Context::new(0);
2020
let ts = Timestamp::now(&CONTEXT);
2121

22-
static NODE_ID: OnceCell<[u8; 6]> = OnceCell::new();
22+
static NODE_ID: OnceLock<[u8; 6]> = OnceLock::new();
2323
let unique_node_id = NODE_ID.get_or_init(get_node_id);
2424

2525
(Uuid::new_v1(ts, unique_node_id).as_bytes().to_vec(), PyNone)

vm/src/vm/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ pub struct PyGlobalState {
107107
}
108108

109109
pub fn process_hash_secret_seed() -> u32 {
110-
use once_cell::sync::OnceCell;
111-
static SEED: OnceCell<u32> = OnceCell::new();
110+
use std::sync::OnceLock;
111+
static SEED: OnceLock<u32> = OnceLock::new();
112112
*SEED.get_or_init(rand::random)
113113
}
114114

0 commit comments

Comments
 (0)