From dd50731b7bcdfe87f171050b545dce846e8ac9cb Mon Sep 17 00:00:00 2001 From: Alex Chan Date: Fri, 23 Oct 2026 17:09:10 -0400 Subject: [PATCH] util/set: provide a size hint when calling Set.Of We already do this for `Set.OfSliceView`. Updates #cleanup Change-Id: I6ce3022ddabae2a0891e76ca45f3a7c601627a02 Signed-off-by: Alex Chan --- util/set/set.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/set/set.go b/util/set/set.go index c6db4f3f2..1458e64d4 100644 --- a/util/set/set.go +++ b/util/set/set.go @@ -24,7 +24,7 @@ func SetOf[T comparable](slice []T) Set[T] { // Of returns a new set constructed from the elements in slice. func Of[T comparable](slice ...T) Set[T] { - s := make(Set[T]) + s := make(Set[T], len(slice)) s.AddSlice(slice) return s }