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 14, 2025
1 parent 31b88c6 commit 45bf751
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions modules/apps/27-interchain-accounts/host/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
slices
)

const (
Expand All @@ -25,11 +26,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 45bf751

Please sign in to comment.