Removed unnecessary functions (using staticcheck
)
This commit is contained in:
17
misc.go
17
misc.go
@@ -54,16 +54,6 @@ func assert(cond bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteFromSlice[T comparable](slc []T, val T) []T {
|
|
||||||
toReturn := make([]T, 0, len(slc))
|
|
||||||
for _, v := range slc {
|
|
||||||
if v != val {
|
|
||||||
toReturn = append(toReturn, v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return toReturn
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure that the given elements are only appended to the given slice if they
|
// Ensure that the given elements are only appended to the given slice if they
|
||||||
// don't already exist. Returns the new slice, and the number of unique items appended.
|
// don't already exist. Returns the new slice, and the number of unique items appended.
|
||||||
func unique_append[T comparable](slc []T, items ...T) ([]T, int) {
|
func unique_append[T comparable](slc []T, items ...T) ([]T, int) {
|
||||||
@@ -149,13 +139,6 @@ func allCases(r rune) []rune {
|
|||||||
return []rune{unicode.ToLower(r), unicode.ToUpper(r), unicode.ToTitle(r)}
|
return []rune{unicode.ToLower(r), unicode.ToUpper(r), unicode.ToTitle(r)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expands a slice to the given length
|
|
||||||
func expandSlice[T any](slc []T, newSize int) []T {
|
|
||||||
toRet := make([]T, newSize)
|
|
||||||
copy(toRet, slc)
|
|
||||||
return toRet
|
|
||||||
}
|
|
||||||
|
|
||||||
func isHex(c rune) bool {
|
func isHex(c rune) bool {
|
||||||
return slices.Contains([]rune("0123456789abcdefABCDEF"), c)
|
return slices.Contains([]rune("0123456789abcdefABCDEF"), c)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user