Skip to content

Commit

Permalink
Accumulate parents in a set to avoid a call to uniq
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
  • Loading branch information
Morriar committed Jun 14, 2024
1 parent 557ab1c commit c9ac6e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ruby_lsp/requests/type_hierarchy_supertypes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def perform
name = @item[:name]
entries = @index[name]

parents = T.let([], T::Array[RubyIndexer::Entry::Namespace])
parents = T.let(Set.new, T::Set[RubyIndexer::Entry::Namespace])
return unless entries&.any?

entries.each do |entry|
Expand Down Expand Up @@ -68,7 +68,7 @@ def perform
end
end

parents.uniq.map { |entry| hierarchy_item(entry) }
parents.map { |entry| hierarchy_item(entry) }
end

private
Expand Down

0 comments on commit c9ac6e4

Please sign in to comment.