@@ -16,23 +16,23 @@ impl Rule for DuplicatedLoadRule {
1616 fn check_node ( & mut self , node : & Node , source_code : & str ) -> Vec < LintIssue > {
1717 if let Some ( function_node) = node. child ( 0 ) {
1818 let function_name = get_node_text ( & function_node, source_code) ;
19- if function_name == "load" || function_name == "preload" {
20- if let Some ( args_node) = node. child_by_field_name ( "arguments" ) {
21- let mut args_cursor = args_node . walk ( ) ;
22- if args_cursor . goto_first_child ( ) {
23- loop {
24- let arg_node = args_cursor . node ( ) ;
25- if arg_node . kind ( ) == "string" {
26- let path = get_node_text ( & arg_node , source_code ) ;
27- let ( line , column ) = get_line_column ( & arg_node) ;
28- self . load_paths
29- . entry ( path . to_string ( ) )
30- . or_insert_with ( Vec :: new )
31- . push ( ( line , column ) ) ;
32- }
33- if !args_cursor . goto_next_sibling ( ) {
34- break ;
35- }
19+ if ( function_name == "load" || function_name == "preload" )
20+ && let Some ( args_node) = node. child_by_field_name ( "arguments" )
21+ {
22+ let mut args_cursor = args_node . walk ( ) ;
23+ if args_cursor . goto_first_child ( ) {
24+ loop {
25+ let arg_node = args_cursor . node ( ) ;
26+ if arg_node . kind ( ) == "string" {
27+ let path = get_node_text ( & arg_node, source_code ) ;
28+ let ( line , column ) = get_line_column ( & arg_node ) ;
29+ self . load_paths
30+ . entry ( path . to_string ( ) )
31+ . or_default ( )
32+ . push ( ( line , column ) ) ;
33+ }
34+ if !args_cursor . goto_next_sibling ( ) {
35+ break ;
3636 }
3737 }
3838 }
0 commit comments