diff --git a/mullvad-api/src/lib.rs b/mullvad-api/src/lib.rs index 5c9b4b726d4f..ed998c370cfb 100644 --- a/mullvad-api/src/lib.rs +++ b/mullvad-api/src/lib.rs @@ -9,7 +9,7 @@ use mullvad_types::{ account::{AccountToken, VoucherSubmission}, version::AppVersion, }; -use once_cell::sync::OnceCell; +use std::sync::OnceLock; use proxy::ApiConnectionMode; use std::{ cell::Cell, @@ -66,18 +66,18 @@ const APP_URL_PREFIX: &str = "app/v1"; pub static API: LazyManual = LazyManual::new(ApiEndpoint::from_env_vars); -unsafe impl Sync for LazyManual where OnceCell: Sync {} +unsafe impl Sync for LazyManual where OnceLock: Sync {} /// A value that is either initialized on access or explicitly. pub struct LazyManual T> { - cell: OnceCell, + cell: OnceLock, lazy_fn: Cell>, } impl LazyManual { const fn new(lazy_fn: F) -> Self { Self { - cell: OnceCell::new(), + cell: OnceLock::new(), lazy_fn: Cell::new(Some(lazy_fn)), } }