rubocop / rubocop-performance

An extension of RuboCop focused on code performance checks.
https://docs.rubocop.org/rubocop-performance
MIT License
682 stars 80 forks source link

Add new `ArrayConcatLiteral` cop to replace `a.concat([1, 2, 3])` with `a.push(1, 2, 3)` #435

Closed amomchilov closed 9 months ago

amomchilov commented 9 months ago

Fixes #434

This PR is stacked on top of commits in #433.

ArrayConcatLiteral synergizes with ArrayPushSingle, so array.concat([x]) will be simplified down to just array << x


Before submitting the PR make sure the following are checked:

amomchilov commented 9 months ago

https://github.com/rubocop/rubocop-performance/issues/434#issuecomment-1888414946