Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(linter): fix clippy error
  • Loading branch information
cblh committed Jul 7, 2024
commit 3c1bead2defb77098b12dd75b8b7cff324c50142
15 changes: 7 additions & 8 deletions crates/oxc_linter/src/rules/unicorn/no_useless_undefined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,22 @@ fn should_ignore(callee: &Expression) -> bool {
match callee {
Expression::Identifier(identifier) => {
let name = identifier.name.as_str();
return is_match_ignore_func_name(name);
is_match_ignore_func_name(name)
}
Expression::StaticMemberExpression(static_assertions) => {
let name = static_assertions.property.name.as_str();
return is_match_ignore_func_name(name);
is_match_ignore_func_name(name)
}
_ => {
return false;
false
}
}
}

fn is_function_bind_call(call_expr: &CallExpression) -> bool {
return !call_expr.optional
!call_expr.optional
&& matches!(&call_expr.callee, Expression::StaticMemberExpression(member_expr)
if member_expr.property.name.as_str() == "bind");
if member_expr.property.name.as_str() == "bind")
}

fn is_undefined(arg: &Argument) -> bool {
Expand Down Expand Up @@ -245,7 +245,7 @@ impl Rule for NoUselessUndefined {
let arguments = &call_expr.arguments;

// Ignore arguments in `Function#bind()`, but not `this` argument
if is_function_bind_call(&call_expr) && arguments.len() != 1 {
if is_function_bind_call(call_expr) && arguments.len() != 1 {
return;
}
let mut undefined_args_spans = Vec::new();
Expand Down Expand Up @@ -275,7 +275,7 @@ impl Rule for NoUselessUndefined {
}
// If all arguments removed, and there is trailing comma, we need remove it.
if remaining_count == 0 {
end = call_expr.span.end - 1
end = call_expr.span.end - 1;
}

let delete_span = Span::new(start, end);
Expand All @@ -285,7 +285,6 @@ impl Rule for NoUselessUndefined {
);
}
_ => {
return;
}
}
}
Expand Down