From 334e628e9c649d6485ed8f4af4a820a359cc4700 Mon Sep 17 00:00:00 2001 From: luchenhan <168071714+luchenhan@users.noreply.github.com> Date: Fri, 10 Jan 2025 22:01:39 +0900 Subject: [PATCH] refactor: using slices.Contains to simplify the code (#13315) Signed-off-by: luchenhan --- node/node.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/node/node.go b/node/node.go index 65b65ad96fe..f43ae11ad22 100644 --- a/node/node.go +++ b/node/node.go @@ -25,6 +25,7 @@ import ( "fmt" "path/filepath" "reflect" + "slices" "strings" "sync" "time" @@ -203,12 +204,7 @@ func (n *Node) doClose(errs []error) error { // containsLifecycle checks if 'lfs' contains 'l'. func containsLifecycle(lfs []Lifecycle, l Lifecycle) bool { - for _, obj := range lfs { - if obj == l { - return true - } - } - return false + return slices.Contains(lfs, l) } // stopServices terminates running services, RPC and p2p networking.