Skip to content

Commit 928f994

Browse files
camchenryCopilot
andauthored
Update tasks/linter_codegen/src/main.rs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Cam McHenry <camchenry@users.noreply.github.com>
1 parent 5255b38 commit 928f994

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tasks/linter_codegen/src/main.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)