lib/rubocop/cop/style/empty_literal.rb in rubocop-0.30.1 vs lib/rubocop/cop/style/empty_literal.rb in rubocop-0.31.0
- old
+ new
@@ -49,19 +49,15 @@
when HASH_NODE
# `some_method {}` is not same as `some_method Hash.new`
# because the braces are interpreted as a block, so we avoid
# the correction. Parentheses around the arguments would
# solve the problem, but we let the user add those manually.
- if first_arg_in_method_call_without_parentheses?(node)
- fail CorrectionNotPossible
- end
+ return if first_arg_in_method_call_without_parentheses?(node)
'{}'
when STR_NODE
"''"
end
- @corrections << lambda do |corrector|
- corrector.replace(node.loc.expression, name)
- end
+ ->(corrector) { corrector.replace(node.loc.expression, name) }
end
def first_arg_in_method_call_without_parentheses?(node)
return false unless node.parent && node.parent.send_type?