diff --git a/Cargo.lock b/Cargo.lock index a1a8207..c8b03e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "ahash" @@ -206,7 +206,6 @@ dependencies = [ "env_logger", "libc", "log", - "once_cell", "regex", "serde", "tempfile", diff --git a/Cargo.toml b/Cargo.toml index 4a2f650..56df435 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,6 @@ serde = { version = "1", features = ["derive"] } tempfile = "3.10" toml = "0.8" regex = "1.10" -once_cell = "1.19" [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/src/dependency.rs b/src/dependency.rs index adfece2..524d528 100644 --- a/src/dependency.rs +++ b/src/dependency.rs @@ -1,6 +1,6 @@ use anyhow::{bail, Result}; -use once_cell::sync::Lazy; use regex::Regex; +use std::sync::LazyLock; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Dependency { @@ -19,11 +19,9 @@ pub enum Dependency { } pub fn parse_dependency(s: &str) -> Result { - // This will change when `std::lazy` is released. - // See https://github.com/rust-lang/rust/issues/74465. - static RE: Lazy = Lazy::new(|| { + static RE: LazyLock = LazyLock::new(|| { Regex::new(r"^((?P[^+=/]+)=)?(?P((?P\w+://([^:@]+(:[^@]+)?@)?[^#+]*?(?P/[^#+/]+)?)(#branch=(?P[^+]+)|#rev=(?P[^+]+))?)|[^+]+)?(?P(\+[^+]+)*)$") - .unwrap() + .expect("dependency's regex must be compiled") }); match RE.captures(s) {