Skip to content

Commit 9e6304d

Browse files
authored
use LazyLock
1 parent a0d3541 commit 9e6304d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/tools/tidy/src/style.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
// ignore-tidy-dbg
1919

2020
use crate::walk::{filter_dirs, walk};
21-
use lazy_static::lazy_static;
2221
use rustc_hash::FxHashMap;
23-
use std::{ffi::OsStr, path::Path};
22+
use std::{ffi::OsStr, path::Path, sync::LazyLock};
2423

2524
#[cfg(test)]
2625
mod tests;
@@ -125,13 +124,14 @@ fn generate_problematic_strings(
125124
.collect()
126125
}
127126

128-
fn contains_problematic_const(trimmed: &str) -> bool {
129-
lazy_static! {
130-
static ref PROBLEMATIC_CONSTS_STRINGS: Vec<String> = generate_problematic_strings(
127+
static PROBLEMATIC_CONSTS_STRINGS: LazyLock<Vec<String>> = LazyLock::new(|| {
128+
generate_problematic_strings(
131129
ROOT_PROBLEMATIC_CONSTS,
132130
&FxHashMap::from_iter(LETTER_DIGIT.iter().copied()),
133-
);
134-
}
131+
)
132+
});
133+
134+
fn contains_problematic_const(trimmed: &str) -> bool {
135135
PROBLEMATIC_CONSTS_STRINGS.iter().any(|s| trimmed.to_uppercase().contains(s))
136136
}
137137

0 commit comments

Comments
 (0)