Skip to content

Commit

Permalink
refactor: using slices.Contains to simplify the code
Browse files Browse the repository at this point in the history
Signed-off-by: dashangcun <[email protected]>
  • Loading branch information
dashangcun committed Jan 9, 2025
1 parent decc8ec commit 64190fa
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions modules/apps/27-interchain-accounts/host/types/keys.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"slices"

sdk "github.com/cosmos/cosmos-sdk/types"
)

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

for _, v := range allowMsgs {
if v == sdk.MsgTypeURL(msg) {
return true
}
}

return false
return slices.Contains(allowMsgs, sdk.MsgTypeURL(msg))
}

0 comments on commit 64190fa

Please sign in to comment.