mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-11 18:32:12 +02:00
Use the generic contains/index from slices instead of our custom one
This commit is contained in:
@@ -120,19 +120,6 @@ func Min[T constraints.Ordered](a T, items ...T) (ans T) {
|
||||
return ans
|
||||
}
|
||||
|
||||
func Index[T comparable](haystack []T, needle T) int {
|
||||
for i, x := range haystack {
|
||||
if x == needle {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func Contains[T comparable](haystack []T, needle T) bool {
|
||||
return Index(haystack, needle) > -1
|
||||
}
|
||||
|
||||
// Keys returns the keys of the map m.
|
||||
// The keys will be an indeterminate order.
|
||||
func Keys[M ~map[K]V, K comparable, V any](m M) []K {
|
||||
|
||||
Reference in New Issue
Block a user