Skip to content

Commit

Permalink
Fix match? that were not detected by RuboCop
Browse files Browse the repository at this point in the history
Maybe because of some false negatives affecting conditionals

Ref: rubocop/rubocop-performance#152
  • Loading branch information
tagliala committed Dec 13, 2024
1 parent cff1ddb commit f6addfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Unreleased

* Minor performance improvements

### Version v1.21.0

* Minor performance improvements
Expand Down
4 changes: 2 additions & 2 deletions lib/css_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
current_media_query << token << ' '
end
end
elsif in_charset or token =~ /@charset/i
elsif in_charset or /@charset/i.match?(token)
# iterate until we are out of the charset declaration
in_charset = !token.include?(';')
elsif !in_string && token.include?('}')
Expand All @@ -467,7 +467,7 @@ def parse_block_into_rule_sets!(block, options = {}) # :nodoc:
current_selectors << token

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

Expand Down

0 comments on commit f6addfb

Please sign in to comment.