Vote #81105
完了Use match? instead of =~ when MatchData is not used
0%
説明
@String#match?@ was added in Ruby 2.4. you can replace @=~@ with faster @String#match?@ or @Regexp#match?@ when MatchData generated by =~ is not necessary.
The attached patch changes such @=~@ to @mach?@. I generated the patch with the following commands.
sed -i '' 's/TargetRubyVersion: 2.3/TargetRubyVersion: 2.4/' .rubocop.yml bundle exec rubocop --only Performance/RegexpMatch -a
journals
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------
related_issues
relates,Closed,34142,Drop Ruby 2.3 support
blocks,Closed,32530,Update RuboCop to 1.12