File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -67,15 +67,14 @@ pub fn generate_rule_runner_impls() -> io::Result<()> {
6767 format ! ( "Some(&{})" , detected_types. to_ast_type_bitset_string( ) )
6868 } ;
6969
70- let values = rule_run_info. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
71- let rule_run_info_init = if values. len ( ) == 1 && values[ 0 ] == "run" {
72- "RuleRunFunctionsImplemented::Run" . to_string ( )
73- } else if values. len ( ) == 1 && values[ 0 ] == "run_on_symbol" {
74- "RuleRunFunctionsImplemented::RunOnSymbol" . to_string ( )
75- } else if values. len ( ) == 1 && values[ 0 ] == "run_once" {
76- "RuleRunFunctionsImplemented::RunOnce" . to_string ( )
77- } else if values. len ( ) == 1 && values[ 0 ] == "run_on_jest_node" {
78- "RuleRunFunctionsImplemented::RunOnJestNode" . to_string ( )
70+ let rule_run_info_init = if rule_run_info. len ( ) == 1 {
71+ match rule_run_info. iter ( ) . next ( ) . map ( |s| s. as_str ( ) ) {
72+ Some ( "run" ) => "RuleRunFunctionsImplemented::Run" . to_string ( ) ,
73+ Some ( "run_on_symbol" ) => "RuleRunFunctionsImplemented::RunOnSymbol" . to_string ( ) ,
74+ Some ( "run_once" ) => "RuleRunFunctionsImplemented::RunOnce" . to_string ( ) ,
75+ Some ( "run_on_jest_node" ) => "RuleRunFunctionsImplemented::RunOnJestNode" . to_string ( ) ,
76+ _ => "RuleRunFunctionsImplemented::Unknown" . to_string ( ) ,
77+ }
7978 } else {
8079 "RuleRunFunctionsImplemented::Unknown" . to_string ( )
8180 } ;
You can’t perform that action at this time.
0 commit comments