From 170c171e85a17c40d09ed77ff06b5dc36b68a0c2 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 24 Apr 2026 13:25:16 +0800 Subject: [PATCH] shellcheck: lower OnceLock to LazyLock --- crates/xtask/src/shellcheck.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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() }