mirror of
https://github.com/nushell/nushell.git
synced 2025-08-11 14:14:38 +02:00
Drop once_cell
dependency (#14198)
This PR drops the `once_cell` dependency from all Nu crates, replacing uses of the [`Lazy`](https://docs.rs/once_cell/latest/once_cell/sync/struct.Lazy.html) type with its `std` equivalent, [`LazyLock`](https://doc.rust-lang.org/std/sync/struct.LazyLock.html).
This commit is contained in:
@ -2,8 +2,8 @@ use indexmap::{indexmap, IndexMap};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_protocol::Signals;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
// Character used to separate directories in a Path Environment variable on windows is ";"
|
||||
#[cfg(target_family = "windows")]
|
||||
@ -15,7 +15,7 @@ const ENV_PATH_SEPARATOR_CHAR: char = ':';
|
||||
#[derive(Clone)]
|
||||
pub struct Char;
|
||||
|
||||
static CHAR_MAP: Lazy<IndexMap<&'static str, String>> = Lazy::new(|| {
|
||||
static CHAR_MAP: LazyLock<IndexMap<&'static str, String>> = LazyLock::new(|| {
|
||||
indexmap! {
|
||||
// These are some regular characters that either can't be used or
|
||||
// it's just easier to use them like this.
|
||||
@ -150,7 +150,7 @@ static CHAR_MAP: Lazy<IndexMap<&'static str, String>> = Lazy::new(|| {
|
||||
}
|
||||
});
|
||||
|
||||
static NO_OUTPUT_CHARS: Lazy<HashSet<&'static str>> = Lazy::new(|| {
|
||||
static NO_OUTPUT_CHARS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
|
||||
[
|
||||
// If the character is in the this set, we don't output it to prevent
|
||||
// the broken of `char --list` command table format and alignment.
|
||||
|
@ -1,12 +1,12 @@
|
||||
use nu_engine::command_prelude::*;
|
||||
use oem_cp::decode_string_complete_table;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
// create a lazycell of all the code_table "Complete" code pages
|
||||
// the commented out code pages are "Incomplete", which means they
|
||||
// are stored as Option<char> and not &[char; 128]
|
||||
static OEM_DECODE: Lazy<HashMap<usize, &[char; 128]>> = Lazy::new(|| {
|
||||
static OEM_DECODE: LazyLock<HashMap<usize, &[char; 128]>> = LazyLock::new(|| {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(437, &oem_cp::code_table::DECODING_TABLE_CP437);
|
||||
// m.insert(720, &oem_cp::code_table::DECODING_TABLE_CP720);
|
||||
|
Reference in New Issue
Block a user