Skip to content

Commit 45bf751

Browse files
committed
refactor: using slices.Contains to simplify the code
Signed-off-by: dashangcun <907225865@qq.com>
1 parent 31b88c6 commit 45bf751

File tree

1 file changed

+2
-7
lines changed
  • modules/apps/27-interchain-accounts/host/types

1 file changed

+2
-7
lines changed

modules/apps/27-interchain-accounts/host/types/keys.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package types
22

33
import (
44
sdk "github.com/cosmos/cosmos-sdk/types"
5+
slices
56
)
67

78
const (
@@ -25,11 +26,5 @@ func ContainsMsgType(allowMsgs []string, msg sdk.Msg) bool {
2526
return true
2627
}
2728

28-
for _, v := range allowMsgs {
29-
if v == sdk.MsgTypeURL(msg) {
30-
return true
31-
}
32-
}
33-
34-
return false
29+
return slices.Contains(allowMsgs, sdk.MsgTypeURL(msg))
3530
}

0 commit comments

Comments
 (0)