lib/rubocop/cop/style/redundant_freeze.rb in rubocop-0.90.0 vs lib/rubocop/cop/style/redundant_freeze.rb in rubocop-0.91.0
- old
+ new
@@ -15,12 +15,13 @@
extend AutoCorrector
include FrozenStringLiteral
MSG = 'Do not freeze immutable objects, as freezing them has no ' \
'effect.'
+ RESTRICT_ON_SEND = %i[freeze].freeze
def on_send(node)
- return unless node.receiver && node.method?(:freeze) &&
+ return unless node.receiver &&
(immutable_literal?(node.receiver) ||
operation_produces_immutable_object?(node.receiver))
add_offense(node) do |corrector|
corrector.remove(node.loc.dot)