about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarijn Schouten <mhkbst@gmail.com>2025-07-15 08:59:41 +0000
committerMarijn Schouten <mhkbst@gmail.com>2025-07-15 09:00:57 +0000
commitda6d7ca1be6586ba8e0d2b89f1d60ff256dfc7ea (patch)
tree39b5e475fb10192127c321b0152b8de2a9b21d18
parent0d6dc2f52de5bd7900f36c3e12234ee5d8fa7f91 (diff)
downloadrust-da6d7ca1be6586ba8e0d2b89f1d60ff256dfc7ea.tar.gz
rust-da6d7ca1be6586ba8e0d2b89f1d60ff256dfc7ea.zip
tidy static regex: OnceLock -> LazyLock
-rw-r--r--src/tools/tidy/src/lib.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index bd8660797a8..a301781fac8 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -13,8 +13,9 @@ use termcolor::WriteColor;
 
 macro_rules! static_regex {
     ($re:literal) => {{
-        static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
-        RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
+        static RE: ::std::sync::LazyLock<::regex::Regex> =
+            ::std::sync::LazyLock::new(|| ::regex::Regex::new($re).unwrap());
+        &*RE
     }};
 }