diff --git a/crates/xtask/src/shellcheck.rs b/crates/xtask/src/shellcheck.rs index 713b6a2c6..79cace797 100644 --- a/crates/xtask/src/shellcheck.rs +++ b/crates/xtask/src/shellcheck.rs @@ -6,7 +6,7 @@ io::{BufRead, BufReader}, path::{Path, PathBuf}, process::Command, - sync::OnceLock, + sync::LazyLock, }; pub fn shellcheck() { @@ -32,9 +32,8 @@ fn is_shell_script>(path: P) -> bool { let Ok(_) = BufReader::new(file).read_line(&mut first_line) else { return false; }; - static SHEBANG_REGEX: OnceLock = OnceLock::new(); + static SHEBANG_REGEX: LazyLock = LazyLock::new(|| Regex::new("^#!.*[^i]sh").unwrap()); SHEBANG_REGEX - .get_or_init(|| Regex::new("^#!.*[^i]sh").unwrap()) .is_match(first_line.trim().as_bytes()) .unwrap() }