diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-25 00:08:25 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-25 00:08:25 +0300 |
commit | 07a308ad1b3e4ac1c6a3d81a60dac5c4254281b9 (patch) | |
tree | 0f58b00d10eda0d7ee97255002bf051205db6dae /app | |
parent | 35ec674ee69a04d771ed82eeb205c3cd527e4112 (diff) |
Enable Rubocop Performance/ReverseEach
`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')
-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 |