refactor: slices.Contains (#24162)
This commit is contained in:
parent
193a7390c4
commit
d2ac39cb46
@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@ -30,12 +31,7 @@ func NewPermissionsForAddress(name string, permissions []string) PermissionsForA
|
||||
|
||||
// HasPermission returns whether the PermissionsForAddress contains permission.
|
||||
func (pa PermissionsForAddress) HasPermission(permission string) bool {
|
||||
for _, perm := range pa.permissions {
|
||||
if perm == permission {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return slices.Contains(pa.permissions, permission)
|
||||
}
|
||||
|
||||
// GetAddress returns the address of the PermissionsForAddress object
|
||||
|
||||
Loading…
Reference in New Issue
Block a user