Skip to content

Commit

Permalink
Remove unnecessary condition
Browse files Browse the repository at this point in the history
In #10137 a fix was made that makes the condition

asgn_node.send_type? && !asgn_node.assignment_method?

unnecessary in AssignmentInCondition#skip_children?(). The spec example
'accepts = in a block followed by method call' that was added to regression
test this part of the code still passes if I remove the condition.
  • Loading branch information
jonas054 authored and bbatsov committed Mar 25, 2024
1 parent 8dab836 commit d0828e5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/rubocop/cop/lint/assignment_in_condition.rb
Expand Up @@ -88,9 +88,7 @@ def conditional_assignment?(asgn_node)
end

def skip_children?(asgn_node)
(asgn_node.send_type? && !asgn_node.assignment_method?) ||
empty_condition?(asgn_node) ||
(safe_assignment_allowed? && safe_assignment?(asgn_node))
empty_condition?(asgn_node) || (safe_assignment_allowed? && safe_assignment?(asgn_node))
end

def traverse_node(node, &block)
Expand Down

0 comments on commit d0828e5

Please sign in to comment.