diff --git a/crates/bws/src/util.rs b/crates/bws/src/util.rs index ba1309992..d53b2a261 100644 --- a/crates/bws/src/util.rs +++ b/crates/bws/src/util.rs @@ -4,10 +4,9 @@ use uuid::Uuid; const VALID_POSIX_NAME_REGEX: &str = "^[a-zA-Z_][a-zA-Z0-9_]*$"; pub(crate) fn is_valid_posix_name(input_text: &str) -> bool { - match Regex::new(VALID_POSIX_NAME_REGEX) { - Ok(r) => r.is_match(input_text), - Err(_) => false, - } + Regex::new(VALID_POSIX_NAME_REGEX) + .expect("VALID_POSIX_NAME_REGEX to be a valid regex") + .is_match(input_text) } /// Converts a UUID to a POSIX-compliant environment variable name.