Skip to content

Commit 2ae5b78

Browse files
committed
Replace Lazy from once_cell with LazyLock from std
1 parent eddee66 commit 2ae5b78

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fancy-regex = "0.17.0"
4141
libc = "0.2.153"
4242
memchr = "2.7.4"
4343
memmap2 = "0.9"
44-
once_cell = "1.21.3"
4544
phf = "0.13.0"
4645
phf_codegen = "0.13.0"
4746
predicates = "3.1.3"
@@ -64,7 +63,6 @@ ctor = "0.6.0"
6463
fancy-regex = { workspace = true }
6564
memchr = { workspace = true }
6665
memmap2.workspace = true
67-
once_cell = { workspace = true }
6866
phf = { workspace = true }
6967
predicates = { workspace = true }
7068
regex = { workspace = true }

src/sed/fast_regex.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ use fancy_regex::{
1515
CaptureMatches as FancyCaptureMatches, Captures as FancyCaptures, Regex as FancyRegex,
1616
};
1717
use memchr::memmem;
18-
use once_cell::sync::Lazy;
1918
use regex::Regex as RustRegex;
2019
use regex::bytes::{
2120
CaptureMatches as ByteCaptureMatches, Captures as ByteCaptures, Regex as ByteRegex,
2221
};
2322
use std::error::Error;
23+
use std::sync::LazyLock;
2424
use uucore::error::{UResult, USimpleError};
2525

2626
use crate::sed::fast_io::IOChunk;
@@ -32,7 +32,8 @@ use crate::sed::fast_io::IOChunk;
3232
// For example, r"\\1" and r"[\1]" will match, whereas only a number
3333
// after an odd number of backslashes and outside a character class
3434
// should match.
35-
static NEEDS_FANCY_RE: Lazy<RustRegex> = Lazy::new(|| regex::Regex::new(r"\\[1-9]").unwrap());
35+
static NEEDS_FANCY_RE: LazyLock<RustRegex> =
36+
LazyLock::new(|| regex::Regex::new(r"\\[1-9]").unwrap());
3637

3738
/// All characters signifying that the match must be handled by an RE
3839
/// rather than by plain string pattern matching.
@@ -41,7 +42,7 @@ static NEEDS_FANCY_RE: Lazy<RustRegex> = Lazy::new(|| regex::Regex::new(r"\\[1-9
4142
// matching, because Regex always constructs an automaton and needs
4243
// to handle state transitions, whereas plain string matching can
4344
// use tailored CPU string or vectored instructions.
44-
static NEEDS_RE: Lazy<RustRegex> = Lazy::new(|| {
45+
static NEEDS_RE: LazyLock<RustRegex> = LazyLock::new(|| {
4546
regex::Regex::new(
4647
r"(?x) # Turn on verbose mode
4748
( ^ # Non-escaped: i.e. at BOL

0 commit comments

Comments
 (0)