summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-08-03 15:23:52 -0700
committerTim Smith <tsmith84@gmail.com>2020-08-03 15:23:52 -0700
commita6fc05725e7eb9cc3284fd68b8a6985bf685c10e (patch)
tree92e17074dc12f054016a8df1d9a28a32ecbb4d1e /lib/chef/util
parent71088574e7b67850612c43e0804d00baa0984506 (diff)
downloadchef-a6fc05725e7eb9cc3284fd68b8a6985bf685c10e.tar.gz
Use sort.reverse instead of sort { |a, b| b <=> a }
It's faster. See https://github.com/rubocop-hq/rubocop-performance/pull/130 Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/util')
-rw-r--r--lib/chef/util/backup.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/util/backup.rb b/lib/chef/util/backup.rb
index 547d4095a3..5728dcaedd 100644
--- a/lib/chef/util/backup.rb
+++ b/lib/chef/util/backup.rb
@@ -87,7 +87,7 @@ class Chef
end
def sorted_backup_files
- unsorted_backup_files.sort { |a, b| b <=> a }
+ unsorted_backup_files.sort.reverse # faster than sort { |a, b| b <=> a }
end
end
end