From 64190fabc61b856f6e0b16e34a48eea1305319b9 Mon Sep 17 00:00:00 2001 From: dashangcun <907225865@qq.com> Date: Fri, 10 Jan 2025 00:19:24 +0800 Subject: [PATCH] refactor: using slices.Contains to simplify the code Signed-off-by: dashangcun <907225865@qq.com> --- 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..2dd87805d6d 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)) }