From 87356d9ca0aea8524f17546f4dac34083bcf0395 Mon Sep 17 00:00:00 2001 From: dashangcun <907225865@qq.com> Date: Fri, 10 Jan 2025 00:15:49 +0800 Subject: [PATCH] refactor: using slices.Contains to simplify the code Signed-off-by: dashangcun <907225865@qq.com> --- relayer/path.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/relayer/path.go b/relayer/path.go index 57b23a9b4..275b4579a 100644 --- a/relayer/path.go +++ b/relayer/path.go @@ -3,6 +3,7 @@ package relayer import ( "context" "fmt" + "slices" "strings" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -152,12 +153,7 @@ func (p *Path) ValidateChannelFilterRule() error { // InChannelList returns true if the channelID argument is in the ChannelFilter's ChannelList or false otherwise. func (cf *ChannelFilter) InChannelList(channelID string) bool { - for _, channel := range cf.ChannelList { - if channel == channelID { - return true - } - } - return false + return slices.Contains(cf.ChannelList, channelID) } // End returns the proper end given a chainID.