diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-24 14:08:25 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-24 14:08:25 -0700 |
commit | 07a308ad1b3e4ac1c6a3d81a60dac5c4254281b9 (patch) | |
tree | 0f58b00d10eda0d7ee97255002bf051205db6dae /app/models/commit.rb | |
parent | 35ec674ee69a04d771ed82eeb205c3cd527e4112 (diff) | |
download | gitlab-ce-07a308ad1b3e4ac1c6a3d81a60dac5c4254281b9.tar.gz |
Enable Rubocop Performance/ReverseEachsh-rubocop-reverse-each
`Array.reverse_each` is faster than `Array.reverse.each` because:
* reverse.each creates a new array then loops each element
* reverse_each loops in reverse order (no intermediate array created)
Diffstat (limited to 'app/models/commit.rb')
-rw-r--r-- | app/models/commit.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index be37fa2e76f..0889ce7e287 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -346,7 +346,7 @@ class Commit if commits_in_merge_request.present? message_body << "" - commits_in_merge_request.reverse.each do |commit_in_merge| + commits_in_merge_request.reverse_each do |commit_in_merge| message_body << "#{commit_in_merge.short_id} #{commit_in_merge.title}" end end |