refactor: use slices.Contains to simplify code (#6069)
Signed-off-by: weifanglab <weifanglab@outlook.com>
This commit is contained in:
parent
14a1c9a53b
commit
9fae524221
1 changed files with 2 additions and 6 deletions
|
|
@ -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.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue