From 20a7861838dc4a978b1a8d8494056a8c45bc815a Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:42:51 +0000 Subject: [PATCH] refactor(linter): shorten `Option` syntax (#5735) Use `Some` instead of `Option::Some`. --- crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs | 4 +--- crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs | 2 +- crates/oxc_linter/src/rules/unicorn/catch_error_name.rs | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs b/crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs index 1a0a68f5cf1c6..828d3415a119c 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs @@ -137,9 +137,7 @@ impl Rule for AnchorIsValid { }; // Don't eagerly get `span` here, to avoid that work unless rule fails let get_span = || jsx_el.opening_element.name.span(); - if let Option::Some(href_attr) = - has_jsx_prop_ignore_case(&jsx_el.opening_element, "href") - { + if let Some(href_attr) = has_jsx_prop_ignore_case(&jsx_el.opening_element, "href") { let JSXAttributeItem::Attribute(attr) = href_attr else { return; }; diff --git a/crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs b/crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs index 4928f140c0f45..db8d9d6af7b3f 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs @@ -142,7 +142,7 @@ impl Rule for AriaRole { fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) { if let AstKind::JSXElement(jsx_el) = node.kind() { - if let Option::Some(aria_role) = has_jsx_prop(&jsx_el.opening_element, "role") { + if let Some(aria_role) = has_jsx_prop(&jsx_el.opening_element, "role") { let Some(element_type) = get_element_type(ctx, &jsx_el.opening_element) else { return; }; diff --git a/crates/oxc_linter/src/rules/unicorn/catch_error_name.rs b/crates/oxc_linter/src/rules/unicorn/catch_error_name.rs index 2e78688398134..6f6703fd7ab2b 100644 --- a/crates/oxc_linter/src/rules/unicorn/catch_error_name.rs +++ b/crates/oxc_linter/src/rules/unicorn/catch_error_name.rs @@ -75,7 +75,7 @@ impl Rule for CatchErrorName { .unwrap_or(&vec![]) .iter() .map(serde_json::Value::as_str) - .filter(std::option::Option::is_some) + .filter(Option::is_some) .map(|x| CompactStr::from(x.unwrap())) .collect::>();