diff --git a/lib/rubocop/cop/performance/redundant_match.rb b/lib/rubocop/cop/performance/redundant_match.rb index e1e4f7b569..4262d8b686 100644 --- a/lib/rubocop/cop/performance/redundant_match.rb +++ b/lib/rubocop/cop/performance/redundant_match.rb @@ -56,6 +56,8 @@ def autocorrect(corrector, node) # @param [RuboCop::AST::SendNode] node # @return [Boolean] def autocorrectable?(node) + # Regexp#match can take a second argument, but this cop doesn't + # register an offense in that case node.receiver.regexp_type? || node.first_argument.regexp_type? end end