Commit cd2bfd16 authored by pinglanlu's avatar pinglanlu Committed by GitHub

refactor: using slices.Contains to simplify the code (#13807)

* refactor: using slices.Contains to simplify the code
Signed-off-by: default avatarpinglanlu <pinglanlu@outlook.com>

* op-batcher: reintroduce helper func to fix other usages

---------
Signed-off-by: default avatarpinglanlu <pinglanlu@outlook.com>
Co-authored-by: default avatarprotolambda <proto@protolambda.com>
parent 0870c633
package flags package flags
import "fmt" import (
"fmt"
"slices"
)
type DataAvailabilityType string type DataAvailabilityType string
...@@ -35,10 +38,5 @@ func (kind *DataAvailabilityType) Clone() any { ...@@ -35,10 +38,5 @@ func (kind *DataAvailabilityType) Clone() any {
} }
func ValidDataAvailabilityType(value DataAvailabilityType) bool { func ValidDataAvailabilityType(value DataAvailabilityType) bool {
for _, k := range DataAvailabilityTypes { return slices.Contains(DataAvailabilityTypes, value)
if k == value {
return true
}
}
return false
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment