From b2062d59157ab277718468d1b7153d8b9b84beaf Mon Sep 17 00:00:00 2001 From: Jonas Arvidsson Date: Sat, 23 Mar 2024 19:23:52 +0100 Subject: [PATCH] Remove unnecessary condition 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. --- lib/rubocop/cop/lint/assignment_in_condition.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/rubocop/cop/lint/assignment_in_condition.rb b/lib/rubocop/cop/lint/assignment_in_condition.rb index d90bd310617..7b20d80f932 100644 --- a/lib/rubocop/cop/lint/assignment_in_condition.rb +++ b/lib/rubocop/cop/lint/assignment_in_condition.rb @@ -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)