Skip to content

Commit

Permalink
Apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
mfbmina committed Dec 28, 2020
1 parent ccf2ef8 commit a57f30f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Performance/RedundantSortBlock:
Performance/RedundantSplitRegexpArgument:
Description: 'This cop identifies places where `split` argument can be replaced from a deterministic regexp to a string.'
Enabled: pending
VersionAdded: '1.9'
VersionAdded: '1.10'

Performance/RedundantStringChars:
Description: 'Checks for redundant `String#chars`.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def autocorrect(corrector, node)
new_argument = node.first_argument.source[1..-2]
new_argument.delete!('\\') unless STR_SPECIAL_CHARS.include?(new_argument)

new_source = "#{node.receiver.source}.split(\"#{new_argument}\")"

corrector.replace(node.source_range, new_source)
corrector.replace(node.first_argument, "\"#{new_argument}\"")
end
end
end
Expand Down

0 comments on commit a57f30f

Please sign in to comment.