From 7212e4d264533a2e251f1d2702161f23a3b25e56 Mon Sep 17 00:00:00 2001 From: piguagua Date: Wed, 15 Jan 2025 17:49:47 +0800 Subject: [PATCH] refactor: using slices.Contains to simplify the code Signed-off-by: piguagua --- utils/slices.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/utils/slices.go b/utils/slices.go index 789c06ba31..6020c96452 100644 --- a/utils/slices.go +++ b/utils/slices.go @@ -32,10 +32,5 @@ func All[T any](slice []T, f func(T) bool) bool { } func AnyOf[T comparable](e T, values ...T) bool { - for _, v := range values { - if e == v { - return true - } - } - return false + return slices.Contains(values, e) }