1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 20:17:45 +00:00

uucore: remove lazy_static & use LazyLock instead

This commit is contained in:
Daniel Hofstetter 2025-03-05 10:13:30 +01:00
parent 0f9b36b0d4
commit 3b9b8c51cf
3 changed files with 4 additions and 8 deletions

1
Cargo.lock generated
View file

@ -3503,7 +3503,6 @@ dependencies = [
"hex",
"iana-time-zone",
"itertools 0.14.0",
"lazy_static",
"libc",
"md-5",
"memchr",

View file

@ -31,7 +31,6 @@ dunce = { version = "1.0.4", optional = true }
wild = "2.2.1"
glob = { workspace = true }
iana-time-zone = { workspace = true }
lazy_static = "1.4.0"
# * optional
itertools = { workspace = true, optional = true }
thiserror = { workspace = true, optional = true }

View file

@ -5,7 +5,6 @@
// spell-checker:ignore anotherfile invalidchecksum regexes JWZG FFFD xffname prefixfilename bytelen bitlen hexdigit
use data_encoding::BASE64;
use lazy_static::lazy_static;
use os_display::Quotable;
use regex::bytes::{Match, Regex};
use std::{
@ -16,6 +15,7 @@ use std::{
io::{self, stdin, BufReader, Read, Write},
path::Path,
str,
sync::LazyLock,
};
use crate::{
@ -478,11 +478,9 @@ const DOUBLE_SPACE_REGEX: &str = r"^(?P<checksum>[a-fA-F0-9]+)\s{2}(?P<filename>
// In this case, we ignore the *
const SINGLE_SPACE_REGEX: &str = r"^(?P<checksum>[a-fA-F0-9]+)\s(?P<filename>\*?(?-u:.*))$";
lazy_static! {
static ref R_ALGO_BASED: Regex = Regex::new(ALGO_BASED_REGEX).unwrap();
static ref R_DOUBLE_SPACE: Regex = Regex::new(DOUBLE_SPACE_REGEX).unwrap();
static ref R_SINGLE_SPACE: Regex = Regex::new(SINGLE_SPACE_REGEX).unwrap();
}
static R_ALGO_BASED: LazyLock<Regex> = LazyLock::new(|| Regex::new(ALGO_BASED_REGEX).unwrap());
static R_DOUBLE_SPACE: LazyLock<Regex> = LazyLock::new(|| Regex::new(DOUBLE_SPACE_REGEX).unwrap());
static R_SINGLE_SPACE: LazyLock<Regex> = LazyLock::new(|| Regex::new(SINGLE_SPACE_REGEX).unwrap());
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
enum LineFormat {