From 28d9a7ff63e88cc65ba1a4cfddd9c16d9160eaa6 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 15 Aug 2023 20:55:09 -0400 Subject: [PATCH] use slices.Contains from go1.21 --- irc/chanserv.go | 3 ++- irc/utils/types.go | 9 --------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/irc/chanserv.go b/irc/chanserv.go index 6e8389ab..a8360c03 100644 --- a/irc/chanserv.go +++ b/irc/chanserv.go @@ -6,6 +6,7 @@ package irc import ( "fmt" "regexp" + "slices" "sort" "strings" "time" @@ -218,7 +219,7 @@ func csAmodeHandler(service *ircService, server *Server, client *Client, command // check for anything valid as a channel mode change that is not valid // as an AMODE change for _, modeChange := range modeChanges { - if !utils.SliceContains(modes.ChannelUserModes, modeChange.Mode) { + if !slices.Contains(modes.ChannelUserModes, modeChange.Mode) { invalid = true } } diff --git a/irc/utils/types.go b/irc/utils/types.go index 47883a47..6b297c51 100644 --- a/irc/utils/types.go +++ b/irc/utils/types.go @@ -35,12 +35,3 @@ func CopyMap[K comparable, V any](input map[K]V) (result map[K]V) { } return } - -func SliceContains[T comparable](slice []T, elem T) (result bool) { - for _, t := range slice { - if elem == t { - return true - } - } - return false -}