Skip to content

Commit

Permalink
Use RESTRICT_ON_SEND for Lint/IdentityComparison
Browse files Browse the repository at this point in the history
Follow rubocop#8699 (comment)
and rubocop#8606.

This PR uses `RESTRICT_ON_SEND` for `Lint/IdentityComparison`.
  • Loading branch information
koic committed Sep 12, 2020
1 parent eca7d75 commit 9abc15c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/rubocop/cop/lint/identity_comparison.rb
Expand Up @@ -20,6 +20,7 @@ class IdentityComparison < Base
extend AutoCorrector

MSG = 'Use `equal?` instead `==` when comparing `object_id`.'
RESTRICT_ON_SEND = %i[==].freeze

def on_send(node)
return unless compare_between_object_id_by_double_equal?(node)
Expand All @@ -36,8 +37,6 @@ def on_send(node)
private

def compare_between_object_id_by_double_equal?(node)
return false unless node.method?(:==)

object_id_method?(node.receiver) && object_id_method?(node.first_argument)
end

Expand Down

0 comments on commit 9abc15c

Please sign in to comment.