From 3d63f19d5007353a0ea3c7fdabd319b93a36d770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=BChmann?= Date: Sat, 21 Dec 2019 09:49:10 +0100 Subject: [PATCH] Remove unnecessary use of regexp --- lib/rubocop/cop/lint/redundant_cop_disable_directive.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb b/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb index 64c4063b8ca..13b6db4666f 100644 --- a/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +++ b/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb @@ -213,7 +213,7 @@ def cop_range(comment, cop) end def matching_range(haystack, needle) - offset = (haystack.source =~ Regexp.new(Regexp.escape(needle))) + offset = haystack.source.index(needle) return unless offset offset += haystack.begin_pos