Skip to content

Commit

Permalink
refactor(linter): shorten Option syntax (#5735)
Browse files Browse the repository at this point in the history
Use `Some` instead of `Option::Some`.
  • Loading branch information
overlookmotel committed Sep 12, 2024
1 parent 805fbac commit 20a7861
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/jsx_a11y/anchor_is_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/jsx_a11y/aria_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/src/rules/unicorn/catch_error_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<CompactStr>>();

Expand Down

0 comments on commit 20a7861

Please sign in to comment.