Skip to content

Commit

Permalink
Remove unnecessary use of regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
buehmann authored and bbatsov committed Dec 21, 2019
1 parent 76e07a2 commit 3d63f19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/lint/redundant_cop_disable_directive.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3d63f19

Please sign in to comment.