Browse Source

use slices.Contains from go1.21

tags/v2.12.0-rc1
Shivaram Lingamneni 8 months ago
parent
commit
28d9a7ff63
2 changed files with 2 additions and 10 deletions
  1. 2
    1
      irc/chanserv.go
  2. 0
    9
      irc/utils/types.go

+ 2
- 1
irc/chanserv.go View File

@@ -6,6 +6,7 @@ package irc
6 6
 import (
7 7
 	"fmt"
8 8
 	"regexp"
9
+	"slices"
9 10
 	"sort"
10 11
 	"strings"
11 12
 	"time"
@@ -218,7 +219,7 @@ func csAmodeHandler(service *ircService, server *Server, client *Client, command
218 219
 	// check for anything valid as a channel mode change that is not valid
219 220
 	// as an AMODE change
220 221
 	for _, modeChange := range modeChanges {
221
-		if !utils.SliceContains(modes.ChannelUserModes, modeChange.Mode) {
222
+		if !slices.Contains(modes.ChannelUserModes, modeChange.Mode) {
222 223
 			invalid = true
223 224
 		}
224 225
 	}

+ 0
- 9
irc/utils/types.go View File

@@ -35,12 +35,3 @@ func CopyMap[K comparable, V any](input map[K]V) (result map[K]V) {
35 35
 	}
36 36
 	return
37 37
 }
38
-
39
-func SliceContains[T comparable](slice []T, elem T) (result bool) {
40
-	for _, t := range slice {
41
-		if elem == t {
42
-			return true
43
-		}
44
-	}
45
-	return false
46
-}

Loading…
Cancel
Save