Skip to content

Commit fbd4f92

Browse files
committed
perf(linter): replace phf_set with array in utils::jest (oxc-project#10369)
Related to oxc-project#10076
1 parent 8d0eb33 commit fbd4f92

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

crates/oxc_linter/src/utils/jest.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use oxc_ast::{
1010
use oxc_index::Idx;
1111
use oxc_semantic::{AstNode, ReferenceId, Semantic, SymbolId};
1212
use oxc_span::CompactStr;
13-
use phf::phf_set;
1413

1514
use crate::LintContext;
1615

@@ -21,25 +20,25 @@ pub use crate::utils::jest::parse_jest_fn::{
2120
ParsedJestFnCall as ParsedJestFnCallNew, parse_jest_fn_call,
2221
};
2322

24-
pub const JEST_METHOD_NAMES: phf::Set<&'static str> = phf_set![
23+
const JEST_METHOD_NAMES: [&str; 18] = [
2524
"afterAll",
2625
"afterEach",
27-
"bench",
2826
"beforeAll",
2927
"beforeEach",
28+
"bench",
3029
"describe",
3130
"expect",
3231
"expectTypeOf",
3332
"fdescribe",
3433
"fit",
3534
"it",
3635
"jest",
37-
"vi",
36+
"pending",
3837
"test",
38+
"vi",
3939
"xdescribe",
4040
"xit",
4141
"xtest",
42-
"pending"
4342
];
4443

4544
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
@@ -255,7 +254,7 @@ fn collect_ids_referenced_to_global<'c>(
255254
.scoping()
256255
.root_unresolved_references()
257256
.iter()
258-
.filter(|(name, _)| JEST_METHOD_NAMES.contains(name))
257+
.filter(|(name, _)| JEST_METHOD_NAMES.binary_search(name).is_ok())
259258
.flat_map(|(_, reference_ids)| reference_ids.iter().copied())
260259
}
261260

0 commit comments

Comments
 (0)