all: refactor swizzling validation to use ContainsRune (#3292)

Replaces strings.IndexRune checks with strings.ContainsRune in IsValidSwizzling for improved readability and idiomatic Go usage.
This commit is contained in:
iliya
2025-08-10 16:04:13 +09:00
committed by GitHub
parent 464aa6ec6f
commit 877351b3c2
+3 -3
View File
@@ -373,21 +373,21 @@ func IsValidSwizzling(s string) bool {
switch {
case strings.IndexByte(xyzw, s[0]) >= 0:
for _, c := range s {
if strings.IndexRune(xyzw, c) == -1 {
if !strings.ContainsRune(xyzw, c) {
return false
}
}
return true
case strings.IndexByte(rgba, s[0]) >= 0:
for _, c := range s {
if strings.IndexRune(rgba, c) == -1 {
if !strings.ContainsRune(rgba, c) {
return false
}
}
return true
case strings.IndexByte(strq, s[0]) >= 0:
for _, c := range s {
if strings.IndexRune(strq, c) == -1 {
if !strings.ContainsRune(strq, c) {
return false
}
}