Skip to content

Commit c845b05

Browse files
refactor: using slices.Contains to simplify the code (#7833)
Signed-off-by: dashangcun <[email protected]> Co-authored-by: Gjermund Garaba <[email protected]>
1 parent c29c1ab commit c845b05

File tree

1 file changed

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

1 file changed

+3
-7
lines changed

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package types
22

33
import (
4+
"slices"
5+
46
sdk "github.com/cosmos/cosmos-sdk/types"
57
)
68

@@ -25,11 +27,5 @@ func ContainsMsgType(allowMsgs []string, msg sdk.Msg) bool {
2527
return true
2628
}
2729

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

0 commit comments

Comments
 (0)