From afe663bd20a275b4b185604d3a4c7d337e563704 Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Mon, 7 Apr 2025 15:31:56 +0000 Subject: [PATCH] perf(linter): replace `phf_set` with `array` in `jest/no-restricted-matchers` (#10297) Related to #10076 --- crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs b/crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs index 685b7a28d81da..495f41c83a41b 100644 --- a/crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs +++ b/crates/oxc_linter/src/rules/jest/no_restricted_matchers.rs @@ -4,7 +4,6 @@ use oxc_ast::AstKind; use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; use oxc_span::Span; -use phf::phf_set; use rustc_hash::FxHashMap; use crate::{ @@ -76,7 +75,7 @@ declare_oxc_lint!( style, ); -const MODIFIER_NAME: phf::Set<&'static str> = phf_set!["not", "rejects", "resolves"]; +const MODIFIER_NAME: [&str; 3] = ["not", "rejects", "resolves"]; impl Rule for NoRestrictedMatchers { fn from_configuration(value: serde_json::Value) -> Self { @@ -142,7 +141,7 @@ impl NoRestrictedMatchers { } fn check_restriction(chain_call: &str, restriction: &str) -> bool { - if MODIFIER_NAME.contains(restriction) + if MODIFIER_NAME.contains(&restriction) || Path::new(restriction).extension().is_some_and(|ext| ext.eq_ignore_ascii_case("not")) { return chain_call.starts_with(restriction);