mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 09:25: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:
@ -19,7 +19,6 @@ nu-utils = { path = "../nu-utils", version = "0.99.2" }
|
||||
nu-engine = { path = "../nu-engine", version = "0.99.2" }
|
||||
nu-color-config = { path = "../nu-color-config", version = "0.99.2" }
|
||||
nu-ansi-term = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
fancy-regex = { workspace = true }
|
||||
tabled = { workspace = true, features = ["ansi"], default-features = false }
|
||||
terminal_size = { workspace = true }
|
||||
|
@ -91,12 +91,14 @@ fn colorize_lead_trail_space(
|
||||
fn colorize_space_one(text: &str, lead: Option<ANSIStr<'_>>, trail: Option<ANSIStr<'_>>) -> String {
|
||||
use fancy_regex::Captures;
|
||||
use fancy_regex::Regex;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
static RE_LEADING: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"(?m)(?P<beginsp>^\s+)").expect("error with leading space regex"));
|
||||
static RE_TRAILING: Lazy<Regex> =
|
||||
Lazy::new(|| Regex::new(r"(?m)(?P<endsp>\s+$)").expect("error with trailing space regex"));
|
||||
static RE_LEADING: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(r"(?m)(?P<beginsp>^\s+)").expect("error with leading space regex")
|
||||
});
|
||||
static RE_TRAILING: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new(r"(?m)(?P<endsp>\s+$)").expect("error with trailing space regex")
|
||||
});
|
||||
|
||||
let mut buf = text.to_owned();
|
||||
|
||||
|
Reference in New Issue
Block a user