Simplified for loops
All checks were successful
/ test (push) Successful in 15s

This commit is contained in:
Eduard Urbach 2025-06-06 12:10:46 +02:00
parent 7a6ed8be9b
commit 046a393313
Signed by: eduard
GPG key ID: 49226B848C78F6C8
2 changed files with 3 additions and 3 deletions

View file

@ -60,7 +60,7 @@ func contains(container any, element any) bool {
matchingElements := 0 matchingElements := 0
for i := 0; i < containerValue.Len(); i++ { for i := range containerValue.Len() {
if containerValue.Index(i).Interface() == elementValue.Index(matchingElements).Interface() { if containerValue.Index(i).Interface() == elementValue.Index(matchingElements).Interface() {
matchingElements++ matchingElements++
} else { } else {
@ -75,7 +75,7 @@ func contains(container any, element any) bool {
return false return false
} }
for i := 0; i < containerValue.Len(); i++ { for i := range containerValue.Len() {
if containerValue.Index(i).Interface() == element { if containerValue.Index(i).Interface() == element {
return true return true
} }

View file

@ -51,4 +51,4 @@ Please see the [license documentation](https://urbach.dev/license).
## Copyright ## Copyright
© 2019 Eduard Urbach © 2019 Eduard Urbach