Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
camc314 committed Jan 9, 2025
1 parent bb6cf08 commit be4cf28
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions crates/oxc_linter/src/rules/eslint/func_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ impl Rule for FuncNames {
|name| {
// if this name shadows a variable in the outer scope **and** that name is referenced
// inside the function body, it is unsafe to add a name to this function
if ctx.scopes().find_binding(func.scope_id(), &name).map_or(
false,
if ctx.scopes().find_binding(func.scope_id(), &name).is_some_and(
|shadowed_var| {
ctx.semantic().symbol_references(shadowed_var).any(
|reference| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn is_focusable<'a>(ctx: &LintContext<'a>, element: &JSXOpeningElement<'a>) -> b

if let Some(JSXAttributeItem::Attribute(attr)) = has_jsx_prop_ignore_case(element, "tabIndex") {
if let Some(attr_value) = &attr.value {
return parse_jsx_value(attr_value).map_or(false, |num| num >= 0.0);
return parse_jsx_value(attr_value).is_ok_and(|num| num >= 0.0);
}
}

Expand Down
6 changes: 2 additions & 4 deletions crates/oxc_linter/src/rules/react/jsx_no_target_blank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,12 @@ impl Rule for JsxNoTargetBlank {
}
} else if attribute_name == "href"
|| attribute_name == "action"
|| ctx.settings().react.get_link_component_attrs(tag_name).map_or(
false,
|| ctx.settings().react.get_link_component_attrs(tag_name).is_some_and(
|link_attribute| {
link_attribute.contains(&CompactStr::new(attribute_name))
},
)
|| ctx.settings().react.get_form_component_attrs(tag_name).map_or(
false,
|| ctx.settings().react.get_form_component_attrs(tag_name).is_some_and(
|form_attribute| {
form_attribute.contains(&CompactStr::new(attribute_name))
},
Expand Down
2 changes: 1 addition & 1 deletion tasks/rulegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl TestCase {
);

// ("null==null", "null === null", None),
Some(format!(r#"({code}, {output}, {config})"#))
Some(format!(r"({code}, {output}, {config})"))
}
}

Expand Down

0 comments on commit be4cf28

Please sign in to comment.