aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/dev-cmd/test-bot.rb
diff options
context:
space:
mode:
authorXu Cheng2016-08-05 22:01:32 +0800
committerGitHub2016-08-05 22:01:32 +0800
commita8566c9848122474b92fc8989eec196d5f4fb69b (patch)
tree896c040fb575962be0aeb27bc9a99454f3514d73 /Library/Homebrew/dev-cmd/test-bot.rb
parent38209aadbfe4fd0c6772467c4bc5c63325d53f6c (diff)
downloadbrew-a8566c9848122474b92fc8989eec196d5f4fb69b.tar.bz2
various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that `[false, nil].any?` will return false, `any?`(O(n)) has much worse performance than `empty?`(O(1)).
Diffstat (limited to 'Library/Homebrew/dev-cmd/test-bot.rb')
-rw-r--r--Library/Homebrew/dev-cmd/test-bot.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/dev-cmd/test-bot.rb b/Library/Homebrew/dev-cmd/test-bot.rb
index 0c1beeca2..37b2663f2 100644
--- a/Library/Homebrew/dev-cmd/test-bot.rb
+++ b/Library/Homebrew/dev-cmd/test-bot.rb
@@ -342,7 +342,7 @@ module Homebrew
@name = "#{diff_start_sha1}-#{diff_end_sha1}"
end
# Handle formulae arguments being passed on the command-line e.g. `brew test-bot wget fish`.
- elsif @formulae && @formulae.any?
+ elsif @formulae && !@formulae.empty?
@name = "#{@formulae.first}-#{diff_end_sha1}"
diff_start_sha1 = diff_end_sha1
# Handle a hash being passed on the command-line e.g. `brew test-bot 1a2b3c`.
@@ -602,7 +602,7 @@ module Homebrew
test "brew", "uninstall", "--force", formula_name
FileUtils.ln bottle_filename, HOMEBREW_CACHE/bottle_filename, :force => true
@formulae.delete(formula_name)
- if unchanged_build_dependencies.any?
+ unless unchanged_build_dependencies.empty?
test "brew", "uninstall", "--force", *unchanged_build_dependencies
unchanged_dependencies -= unchanged_build_dependencies
end
@@ -652,7 +652,7 @@ module Homebrew
test "brew", "uninstall", "--devel", "--force", formula_name
end
end
- test "brew", "uninstall", "--force", *unchanged_dependencies if unchanged_dependencies.any?
+ test "brew", "uninstall", "--force", *unchanged_dependencies unless unchanged_dependencies.empty?
end
def homebrew