lib/rubocop/cop/style/infinite_loop.rb in rubocop-0.30.1 vs lib/rubocop/cop/style/infinite_loop.rb in rubocop-0.31.0
- old
+ new
@@ -38,17 +38,17 @@
add_offense(node, :keyword)
end
def autocorrect(node)
- @corrections << lambda do |corrector|
- condition_node, = *node
- start_range = node.loc.keyword.begin
- end_range = if node.loc.begin
- node.loc.begin.end
- else
- condition_node.loc.expression.end
- end
+ condition_node, = *node
+ start_range = node.loc.keyword.begin
+ end_range = if node.loc.begin
+ node.loc.begin.end
+ else
+ condition_node.loc.expression.end
+ end
+ lambda do |corrector|
corrector.replace(start_range.join(end_range), 'loop do')
end
end
end
end