From 65760e8f585bb45366c3451a03973bea79296187 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Wed, 20 Mar 2024 22:14:48 -0400 Subject: [PATCH] perf(audit): remove extra key check --- Cargo.lock | 2 +- accessibility-rs/Cargo.toml | 2 +- accessibility-rs/src/engine/audit/wcag.rs | 32 +++++++++-------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d08fc6..b95d7cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "accessibility-rs" -version = "0.0.50" +version = "0.0.51" dependencies = [ "accessibility-scraper", "accessibility-tree", diff --git a/accessibility-rs/Cargo.toml b/accessibility-rs/Cargo.toml index 30fa426..44b12d9 100644 --- a/accessibility-rs/Cargo.toml +++ b/accessibility-rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "accessibility-rs" -version = "0.0.50" +version = "0.0.51" authors = ["The A11yWatch Project Developers", "Jeff Mendez "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/accessibility-rs/src/engine/audit/wcag.rs b/accessibility-rs/src/engine/audit/wcag.rs index 4bc3524..d25dbb1 100644 --- a/accessibility-rs/src/engine/audit/wcag.rs +++ b/accessibility-rs/src/engine/audit/wcag.rs @@ -45,28 +45,22 @@ impl WCAGAAA { let mut issues: Vec = Vec::new(); for node in auditor.tree.clone().iter() { - if RULES_A.contains_key(&*node.0) { - match RULES_A.get(&*node.0) { - Some(rules) => { - for rule in rules { - match (rule.validate)(&node.1, &mut auditor) { - RuleValidation::Single(validation) => push_issue( - validation, - rule, - &node.0, - &auditor.locale, - &mut issues, - ), - RuleValidation::Multi(validation) => { - for v in validation { - push_issue(v, rule, &node.0, &auditor.locale, &mut issues) - } + match RULES_A.get(&*node.0) { + Some(rules) => { + for rule in rules { + match (rule.validate)(&node.1, &mut auditor) { + RuleValidation::Single(validation) => { + push_issue(validation, rule, &node.0, &auditor.locale, &mut issues) + } + RuleValidation::Multi(validation) => { + for v in validation { + push_issue(v, rule, &node.0, &auditor.locale, &mut issues) } - }; - } + } + }; } - _ => (), } + _ => (), } }