From 0f4a073eafbcba211ad41a606c065811ca54d025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Audiger?= <31616285+jaudiger@users.noreply.github.com> Date: Wed, 22 Mar 2023 19:36:52 +0100 Subject: [PATCH] Remove once_cell dependency from nu-test-support create. (#8568) I was looking where we could remove the usage of once-cell dependency. As for now, I only found one place. Not a terrible improvement, but at least, it removes a dependency nu-test-support crate. Relies on `Mutex::new` constified in Rust 1.63.0 --- Cargo.lock | 1 - crates/nu-test-support/Cargo.toml | 1 - crates/nu-test-support/src/locale_override.rs | 5 ++--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6274839444..184315db5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3039,7 +3039,6 @@ dependencies = [ "nu-path", "nu-utils", "num-format", - "once_cell", "tempfile", "which", ] diff --git a/crates/nu-test-support/Cargo.toml b/crates/nu-test-support/Cargo.toml index 808865d4ae..950bf39fd3 100644 --- a/crates/nu-test-support/Cargo.toml +++ b/crates/nu-test-support/Cargo.toml @@ -15,7 +15,6 @@ bench = false nu-path = { path="../nu-path", version = "0.77.2" } nu-glob = { path = "../nu-glob", version = "0.77.2" } nu-utils = { path="../nu-utils", version = "0.77.2" } -once_cell = "1.16.0" num-format = "0.4.3" which = "4.3.0" diff --git a/crates/nu-test-support/src/locale_override.rs b/crates/nu-test-support/src/locale_override.rs index 2fafd2693a..f00dd826e9 100644 --- a/crates/nu-test-support/src/locale_override.rs +++ b/crates/nu-test-support/src/locale_override.rs @@ -1,11 +1,10 @@ #![cfg(debug_assertions)] -use std::sync::{Arc, Mutex}; +use std::sync::Mutex; use nu_utils::locale::LOCALE_OVERRIDE_ENV_VAR; -use once_cell::sync::Lazy; -static LOCALE_OVERRIDE_MUTEX: Lazy>> = Lazy::new(Default::default); +static LOCALE_OVERRIDE_MUTEX: Mutex<()> = Mutex::new(()); /// Run a closure in a fake locale environment. ///