replace lazy_static with once_cell (#7502)

replacing the dependence on `lazy_static` with `once_cell`, this will
ensure that variables are initialized when needed instead of startup
time.
This commit is contained in:
Jaffar Ashoor
2022-12-17 21:30:04 +03:00
committed by GitHub
parent 90849a067f
commit c3c41a61b0
11 changed files with 69 additions and 99 deletions

View File

@ -14,7 +14,7 @@ doctest = false
nu-path = { path="../nu-path", version = "0.72.2" }
nu-glob = { path = "../nu-glob", version = "0.72.2" }
nu-utils = { path="../nu-utils", version = "0.72.2" }
lazy_static = "1.4.0"
once_cell = "1.16.0"
num-format = "0.4.3"
getset = "0.1.1"

View File

@ -2,12 +2,10 @@
use std::sync::{Arc, Mutex};
use lazy_static::lazy_static;
use nu_utils::locale::LOCALE_OVERRIDE_ENV_VAR;
use once_cell::sync::Lazy;
lazy_static! {
static ref LOCALE_OVERRIDE_MUTEX: Arc<Mutex<()>> = Arc::new(Mutex::new(()));
}
static LOCALE_OVERRIDE_MUTEX: Lazy<Arc<Mutex<()>>> = Lazy::new(Default::default);
/// Run a closure in a fake locale environment.
///