Skip to content

Commit 3f37ed1

Browse files
authored
refactor(linter): Replace lazy_static with std::sync::LazyLock (#12822)
1 parent 13f0658 commit 3f37ed1

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ itoa = "1.0.15"
198198
json-strip-comments = "1.0.4"
199199
language-tags = "0.3.2"
200200
lazy-regex = "3.4.1"
201-
lazy_static = "1.5.0"
202201
log = "0.4.27"
203202
markdown = "1.0.0"
204203
memchr = "2.7.5"
@@ -236,7 +235,7 @@ ureq = { version = "3.0.12", default-features = false }
236235
walkdir = "2.5.0"
237236

238237
[workspace.metadata.cargo-shear]
239-
ignored = ["napi", "oxc_transform_napi", "oxc_parser_napi", "oxc_minify_napi", "prettyplease", "lazy_static"]
238+
ignored = ["napi", "oxc_transform_napi", "oxc_parser_napi", "oxc_minify_napi", "prettyplease"]
240239

241240
[profile.dev]
242241
# Disabling debug info speeds up local and CI builds,

crates/oxc_linter/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ javascript-globals = { workspace = true }
6060
json-strip-comments = { workspace = true }
6161
language-tags = { workspace = true }
6262
lazy-regex = { workspace = true }
63-
lazy_static = { workspace = true }
6463
memchr = { workspace = true }
6564
nonmax = { workspace = true }
6665
phf = { workspace = true, features = ["macros"] }

crates/oxc_macros/src/declare_all_lint_rules.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,9 @@ pub fn declare_all_lint_rules(metadata: AllLintRulesMeta) -> TokenStream {
205205
}
206206
}
207207

208-
lazy_static::lazy_static! {
209-
pub static ref RULES: Vec<RuleEnum> = vec![
210-
#(RuleEnum::#struct_names(#struct_names::default())),*
211-
];
212-
}
208+
pub static RULES: std::sync::LazyLock<Vec<RuleEnum>> = std::sync::LazyLock::new(|| vec![
209+
#(RuleEnum::#struct_names(#struct_names::default())),*
210+
]);
213211
};
214212

215213
TokenStream::from(expanded)

0 commit comments

Comments
 (0)