1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Deduplicate results just once

Instead of checking for uniqueness for every spec.

https://github.com/rubygems/rubygems/commit/97d28c9665
This commit is contained in:
David Rodríguez 2022-09-09 00:05:49 +02:00 committed by git
parent 75d90cc8e5
commit 2aa8edaec7

View file

@ -58,19 +58,12 @@ module Bundler
# about, returning all of the results.
def search(query)
results = local_search(query)
seen = results.map(&:full_name).uniq unless @sources.empty?
return results unless @sources.any?
@sources.each do |source|
source.search(query).each do |spec|
next if seen.include?(spec.full_name)
seen << spec.full_name
results << spec
end
results.concat(source.search(query))
end
results
results.uniq(&:full_name)
end
def local_search(query)