From 9f7c2d88106151f15fd134c3288e557b93c91976 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 25 Oct 2023 16:06:12 +0300 Subject: [PATCH] [#752] innerring: Simplify keyPosition() Signed-off-by: Evgenii Stratonikov --- pkg/innerring/indexer.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/innerring/indexer.go b/pkg/innerring/indexer.go index 5d0a87d6..45135a57 100644 --- a/pkg/innerring/indexer.go +++ b/pkg/innerring/indexer.go @@ -110,15 +110,11 @@ func (s *innerRingIndexer) AlphabetIndex() (int32, error) { // keyPosition returns "-1" if key is not found in the list, otherwise returns // index of the key. -func keyPosition(key *keys.PublicKey, list keys.PublicKeys) (result int32) { - result = -1 - +func keyPosition(key *keys.PublicKey, list keys.PublicKeys) int32 { for i := range list { if key.Equal(list[i]) { - result = int32(i) - break + return int32(i) } } - - return result + return -1 }