File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
crates/oxc_linter/src/rules/unicorn Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -129,11 +129,11 @@ fn is_typechecking_call_expr(call_expr: &CallExpression) -> bool {
129129
130130 match & call_expr. callee {
131131 Expression :: Identifier ( ident) => {
132- TYPE_CHECKING_GLOBAL_IDENTIFIERS . contains ( ident. name . as_str ( ) )
132+ TYPE_CHECKING_GLOBAL_IDENTIFIERS . contains ( & ident. name . as_str ( ) )
133133 }
134134 callee @ match_member_expression ! ( Expression ) => {
135135 if let Some ( ident) = callee. to_member_expression ( ) . static_property_name ( ) {
136- return TYPE_CHECKING_IDENTIFIERS . contains ( ident) ;
136+ return TYPE_CHECKING_IDENTIFIERS . binary_search ( & ident) . is_ok ( ) ;
137137 }
138138 false
139139 }
@@ -143,13 +143,13 @@ fn is_typechecking_call_expr(call_expr: &CallExpression) -> bool {
143143
144144fn is_type_checking_member_expr ( member_expr : & MemberExpression ) -> bool {
145145 if let Some ( ident) = member_expr. static_property_name ( ) {
146- return TYPE_CHECKING_IDENTIFIERS . contains ( ident) ;
146+ return TYPE_CHECKING_IDENTIFIERS . binary_search ( & ident) . is_ok ( ) ;
147147 }
148148
149149 false
150150}
151151
152- const TYPE_CHECKING_IDENTIFIERS : phf :: Set < & ' static str > = phf :: phf_set! (
152+ const TYPE_CHECKING_IDENTIFIERS : [ & str ; 36 ] = [
153153 "isArray" ,
154154 "isArrayBuffer" ,
155155 "isArrayLike" ,
@@ -186,10 +186,9 @@ const TYPE_CHECKING_IDENTIFIERS: phf::Set<&'static str> = phf::phf_set!(
186186 "isWeakSet" ,
187187 "isWindow" ,
188188 "isXMLDoc" ,
189- ) ;
189+ ] ;
190190
191- const TYPE_CHECKING_GLOBAL_IDENTIFIERS : phf:: Set < & ' static str > =
192- phf:: phf_set!( "isFinite" , "isNaN" , ) ;
191+ const TYPE_CHECKING_GLOBAL_IDENTIFIERS : [ & str ; 2 ] = [ "isFinite" , "isNaN" ] ;
193192
194193#[ test]
195194fn test ( ) {
You can’t perform that action at this time.
0 commit comments