FIX: Apply copilot hints
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
b1327d83d4
commit
689f55effa
@@ -5,11 +5,12 @@ use super::Node;
|
||||
use regex::Regex;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
static RE: OnceLock<Regex> = OnceLock::new();
|
||||
static RANGE_REFERENCE_REGEX: OnceLock<Regex> = OnceLock::new();
|
||||
|
||||
#[allow(clippy::expect_used)]
|
||||
fn get_re() -> &'static Regex {
|
||||
RE.get_or_init(|| Regex::new(r":[A-Z]*[0-9]*$").expect("Regex is known to be valid"))
|
||||
RANGE_REFERENCE_REGEX
|
||||
.get_or_init(|| Regex::new(r":[A-Z]*[0-9]*$").expect("Regex is known to be valid"))
|
||||
}
|
||||
|
||||
fn is_range_reference(s: &str) -> bool {
|
||||
|
||||
@@ -76,5 +76,5 @@ fn get_locales() -> &'static HashMap<String, Locale> {
|
||||
pub fn get_locale(id: &str) -> Result<&Locale, String> {
|
||||
get_locales()
|
||||
.get(id)
|
||||
.ok_or_else(|| "Invalid locale".to_string())
|
||||
.ok_or_else(|| format!("Invalid locale: '{id}'"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user