@@ -292,10 +292,7 @@ impl<'a> QwikTransform<'a> {
292
292
}
293
293
}
294
294
295
- fn register_context_name (
296
- & mut self ,
297
- custom_symbol : Option < Atom > ,
298
- ) -> ( Atom , Atom , Atom , u64 ) {
295
+ fn register_context_name ( & mut self , custom_symbol : Option < Atom > ) -> ( Atom , Atom , Atom , u64 ) {
299
296
if let Some ( custom_symbol) = custom_symbol {
300
297
return (
301
298
custom_symbol. clone ( ) ,
@@ -310,7 +307,7 @@ impl<'a> QwikTransform<'a> {
310
307
}
311
308
display_name = escape_sym ( & display_name) ;
312
309
let first_char = display_name. chars ( ) . next ( ) ;
313
- if first_char. map_or ( false , |c| c. is_ascii_digit ( ) ) {
310
+ if first_char. is_some_and ( |c| c. is_ascii_digit ( ) ) {
314
311
display_name = format ! ( "_{}" , display_name) ;
315
312
}
316
313
let index = match self . segment_names . get_mut ( & display_name) {
@@ -2030,7 +2027,7 @@ impl<'a> Fold for QwikTransform<'a> {
2030
2027
let is_const = node. kind == ast:: VarDeclKind :: Const ;
2031
2028
2032
2029
for ident in identifiers {
2033
- let is_static = static_identifiers. iter ( ) . any ( |id| * id == ident. 0 ) ;
2030
+ let is_static = static_identifiers. contains ( & ident. 0 ) ;
2034
2031
current_scope. push ( ( ident. 0 , IdentType :: Var ( is_const && is_static) ) ) ;
2035
2032
}
2036
2033
}
@@ -2039,11 +2036,12 @@ impl<'a> Fold for QwikTransform<'a> {
2039
2036
}
2040
2037
2041
2038
fn fold_var_declarator ( & mut self , node : ast:: VarDeclarator ) -> ast:: VarDeclarator {
2042
- let mut stacked = false ;
2043
- if let ast:: Pat :: Ident ( ref ident) = node. name {
2039
+ let stacked = if let ast:: Pat :: Ident ( ref ident) = node. name {
2044
2040
self . stack_ctxt . push ( ident. id . sym . to_string ( ) ) ;
2045
- stacked = true ;
2046
- }
2041
+ true
2042
+ } else {
2043
+ false
2044
+ } ;
2047
2045
let o = node. fold_children_with ( self ) ;
2048
2046
if stacked {
2049
2047
self . stack_ctxt . pop ( ) ;
@@ -2234,12 +2232,12 @@ impl<'a> Fold for QwikTransform<'a> {
2234
2232
}
2235
2233
2236
2234
fn fold_jsx_element ( & mut self , node : ast:: JSXElement ) -> ast:: JSXElement {
2237
- let mut stacked = false ;
2238
-
2239
- if let ast:: JSXElementName :: Ident ( ref ident) = node. opening . name {
2235
+ let stacked = if let ast:: JSXElementName :: Ident ( ref ident) = node. opening . name {
2240
2236
self . stack_ctxt . push ( ident. sym . to_string ( ) ) ;
2241
- stacked = true ;
2242
- }
2237
+ true
2238
+ } else {
2239
+ false
2240
+ } ;
2243
2241
let o = node. fold_children_with ( self ) ;
2244
2242
if stacked {
2245
2243
self . stack_ctxt . pop ( ) ;
@@ -2504,15 +2502,11 @@ fn compute_scoped_idents(all_idents: &[Id], all_decl: &[IdPlusType]) -> (Vec<Id>
2504
2502
}
2505
2503
2506
2504
fn get_canonical_filename ( display_name : & Atom , symbol_name : & Atom ) -> Atom {
2507
- let hash = symbol_name. split ( '_' ) . last ( ) . unwrap ( ) ;
2505
+ let hash = symbol_name. split ( '_' ) . next_back ( ) . unwrap ( ) ;
2508
2506
Atom :: from ( format ! ( "{}_{}" , display_name, hash) )
2509
2507
}
2510
2508
2511
- fn parse_symbol_name (
2512
- symbol_name : Atom ,
2513
- dev : bool ,
2514
- file_name : & String ,
2515
- ) -> ( Atom , Atom , Atom ) {
2509
+ fn parse_symbol_name ( symbol_name : Atom , dev : bool , file_name : & String ) -> ( Atom , Atom , Atom ) {
2516
2510
let mut splitter = symbol_name. rsplitn ( 2 , '_' ) ;
2517
2511
let hash = splitter
2518
2512
. next ( )
@@ -2556,10 +2550,7 @@ fn get_qrl_dev_obj(abs_path: Atom, segment: &SegmentData, span: &Span) -> ast::E
2556
2550
} ) ) ) ,
2557
2551
} ) ) ) ,
2558
2552
ast:: PropOrSpread :: Prop ( Box :: new( ast:: Prop :: KeyValue ( ast:: KeyValueProp {
2559
- key: ast:: PropName :: Ident ( ast:: IdentName :: new(
2560
- Atom :: from( "displayName" ) ,
2561
- DUMMY_SP ,
2562
- ) ) ,
2553
+ key: ast:: PropName :: Ident ( ast:: IdentName :: new( Atom :: from( "displayName" ) , DUMMY_SP ) ) ,
2563
2554
value: Box :: new( ast:: Expr :: Lit ( ast:: Lit :: Str ( ast:: Str {
2564
2555
span: DUMMY_SP ,
2565
2556
value: segment. display_name. clone( ) ,
0 commit comments