From c845b054b9901333b80b0fef48b7ad3849e77a20 Mon Sep 17 00:00:00 2001 From: dashangcun <907225865@qq.com> Date: Thu, 16 Jan 2025 19:04:30 +0100 Subject: [PATCH] refactor: using slices.Contains to simplify the code (#7833) Signed-off-by: dashangcun <907225865@qq.com> Co-authored-by: Gjermund Garaba --- modules/apps/27-interchain-accounts/host/types/keys.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/apps/27-interchain-accounts/host/types/keys.go b/modules/apps/27-interchain-accounts/host/types/keys.go index b566a613f55..16759f555d4 100644 --- a/modules/apps/27-interchain-accounts/host/types/keys.go +++ b/modules/apps/27-interchain-accounts/host/types/keys.go @@ -1,6 +1,8 @@ package types import ( + "slices" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -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)) }