From 0345db6ca757f72f2fbe061594b06539ff1b1296 Mon Sep 17 00:00:00 2001 From: shulaoda Date: Sun, 13 Apr 2025 01:09:47 +0800 Subject: [PATCH] perf(linter): replace phf_set with array in unicorn/prefer-spread --- crates/oxc_linter/src/rules/unicorn/prefer_spread.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs index 6bc5e93f52465..abee4f3f00695 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs @@ -6,7 +6,6 @@ use oxc_ast::{ use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; use oxc_span::{GetSpan, Span}; -use phf::phf_set; use crate::{AstNode, ast_util, context::LintContext, rule::Rule}; @@ -114,7 +113,7 @@ fn check_unicorn_prefer_spread(call_expr: &CallExpression, ctx: &LintContext) { } if let Expression::Identifier(ident) = member_expr_obj { - if IGNORED_SLICE_CALLEE.contains(ident.name.as_str()) { + if IGNORED_SLICE_CALLEE.contains(&ident.name.as_str()) { return; } } @@ -179,13 +178,7 @@ fn check_unicorn_prefer_spread(call_expr: &CallExpression, ctx: &LintContext) { } } -const IGNORED_SLICE_CALLEE: phf::Set<&'static str> = phf_set! { - "arrayBuffer", - "blob", - "buffer", - "file", - "this", -}; +const IGNORED_SLICE_CALLEE: [&str; 5] = ["arrayBuffer", "blob", "buffer", "file", "this"]; fn is_not_array(expr: &Expression, ctx: &LintContext) -> bool { if matches!(