From 5b0b5b52c7670908ea67556286b1cb17f4c54343 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Wed, 30 Oct 2024 10:25:52 +0800 Subject: [PATCH] common: fix staticcheck warning S1001: replace loop with copy --- common/types.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/types.go b/common/types.go index c7abab289b..2f621a4a5f 100644 --- a/common/types.go +++ b/common/types.go @@ -143,9 +143,7 @@ func (h *Hash) SetString(s string) { h.SetBytes([]byte(s)) } // Sets h to other func (h *Hash) Set(other Hash) { - for i, v := range other { - h[i] = v - } + copy(h[:], other[:]) } // Generate implements testing/quick.Generator. @@ -262,9 +260,7 @@ func (a *Address) SetString(s string) { a.SetBytes([]byte(s)) } // Sets a to other func (a *Address) Set(other Address) { - for i, v := range other { - a[i] = v - } + copy(a[:], other[:]) } // MarshalText returns the hex representation of a.