mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 00:35:01 +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:
@ -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