Skip to content

Commit f6addfb

Browse files
committed
Fix match? that were not detected by RuboCop
Maybe because of some false negatives affecting conditionals Ref: rubocop/rubocop-performance#152
1 parent cff1ddb commit f6addfb

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Unreleased
44

5+
* Minor performance improvements
6+
57
### Version v1.21.0
68

79
* Minor performance improvements

lib/css_parser/parser.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
448448
current_media_query << token << ' '
449449
end
450450
end
451-
elsif in_charset or token =~ /@charset/i
451+
elsif in_charset or /@charset/i.match?(token)
452452
# iterate until we are out of the charset declaration
453453
in_charset = !token.include?(';')
454454
elsif !in_string && token.include?('}')
@@ -467,7 +467,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
467467
current_selectors << token
468468

469469
# mark this as the beginning of the selector unless we have already marked it
470-
rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && token =~ /^[^\s]+$/
470+
rule_start = start_offset if options[:capture_offsets] && rule_start.nil? && /^[^\s]+$/.match?(token)
471471
end
472472
end
473473

0 commit comments

Comments
 (0)