UPDATE: Removes once_Cell dependency

This commit is contained in:
Nicolás Hatcher
2025-07-03 20:23:03 +02:00
committed by Nicolás Hatcher Andrés
parent 8f7798d088
commit b1327d83d4
5 changed files with 29 additions and 22 deletions

View File

@@ -2,15 +2,18 @@ use crate::functions::Function;
use super::Node;
use once_cell::sync::Lazy;
use regex::Regex;
use std::sync::OnceLock;
static RE: OnceLock<Regex> = OnceLock::new();
#[allow(clippy::expect_used)]
static RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r":[A-Z]*[0-9]*$").expect("Regex is known to be valid"));
fn get_re() -> &'static Regex {
RE.get_or_init(|| Regex::new(r":[A-Z]*[0-9]*$").expect("Regex is known to be valid"))
}
fn is_range_reference(s: &str) -> bool {
RE.is_match(s)
get_re().is_match(s)
}
/*