lib/rubocop/cop/style/infinite_loop.rb in rubocop-0.51.0 vs lib/rubocop/cop/style/infinite_loop.rb in rubocop-0.52.0

- old
+ new

@@ -33,20 +33,20 @@ end alias on_while_post on_while alias on_until_post on_until - private - def autocorrect(node) if node.while_post_type? || node.until_post_type? replace_begin_end_with_modifier(node) elsif node.modifier_form? replace_source(node.source_range, modifier_replacement(node)) else replace_source(non_modifier_range(node), 'loop do') end end + + private def replace_begin_end_with_modifier(node) lambda do |corrector| corrector.replace(node.body.loc.begin, 'loop do') corrector.remove(node.body.loc.end.end.join(node.source_range.end))