Skip to content

Commit 283e4c7

Browse files
committed
perf(linter): replace phf_set with array in react/exhaustive-deps (#10337)
Related to #10076
1 parent 8b8d708 commit 283e4c7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

crates/oxc_linter/src/rules/react/exhaustive_deps.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::hash::Hash;
22

33
use itertools::Itertools;
4-
use phf::phf_set;
54
use rustc_hash::FxHashSet;
65

76
use oxc_ast::{
@@ -194,8 +193,7 @@ declare_oxc_lint!(
194193
nursery
195194
);
196195

197-
const HOOKS_USELESS_WITHOUT_DEPENDENCIES: phf::Set<&'static str> =
198-
phf_set!("useCallback", "useMemo");
196+
const HOOKS_USELESS_WITHOUT_DEPENDENCIES: [&str; 2] = ["useCallback", "useMemo"];
199197

200198
impl Rule for ExhaustiveDeps {
201199
fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) {
@@ -227,7 +225,7 @@ impl Rule for ExhaustiveDeps {
227225
let is_effect = hook_name.as_str().contains("Effect");
228226

229227
if dependencies_node.is_none() && !is_effect {
230-
if HOOKS_USELESS_WITHOUT_DEPENDENCIES.contains(hook_name.as_str()) {
228+
if HOOKS_USELESS_WITHOUT_DEPENDENCIES.contains(&hook_name.as_str()) {
231229
ctx.diagnostic(dependency_array_required_diagnostic(
232230
hook_name.as_str(),
233231
call_expr.span(),

0 commit comments

Comments
 (0)