refactor: use slices.Contains to simplify code (#6069)

Signed-off-by: weifanglab <weifanglab@outlook.com>
This commit is contained in:
weifanglab 2026-07-07 09:25:38 +08:00 committed by GitHub
parent 14a1c9a53b
commit 9fae524221
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
package scheduler package scheduler
import ( import (
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -208,12 +209,7 @@ type listMatcher struct {
} }
func (m *listMatcher) matches(value int) bool { func (m *listMatcher) matches(value int) bool {
for _, v := range m.values { return slices.Contains(m.values, value)
if v == value {
return true
}
}
return false
} }
// stepMatcher matches values at regular intervals. // stepMatcher matches values at regular intervals.