From b5aefe07e5afe2fd5d49c6a4219cc826b3e4e34e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Tue, 14 Oct 2025 11:40:26 +0200 Subject: all: remove unnecessary loop variable copies in tests Copying the loop variable is no longer necessary since Go 1.22. Change-Id: Iebb21dac44a20ec200567f1d786f105a4ee4999d Reviewed-on: https://go-review.googlesource.com/c/go/+/711640 Reviewed-by: Florian Lehner Auto-Submit: Damien Neil Reviewed-by: Dmitri Shuralyov Reviewed-by: Damien Neil Auto-Submit: Tobias Klauser LUCI-TryBot-Result: Go LUCI --- src/internal/fuzz/encoding_test.go | 2 -- src/internal/fuzz/minimize_test.go | 1 - src/internal/fuzz/worker_test.go | 1 - 3 files changed, 4 deletions(-) (limited to 'src/internal/fuzz') diff --git a/src/internal/fuzz/encoding_test.go b/src/internal/fuzz/encoding_test.go index a46a347403..5f2af4476b 100644 --- a/src/internal/fuzz/encoding_test.go +++ b/src/internal/fuzz/encoding_test.go @@ -260,7 +260,6 @@ func BenchmarkMarshalCorpusFile(b *testing.B) { } for sz := 1; sz <= len(buf); sz <<= 1 { - sz := sz b.Run(strconv.Itoa(sz), func(b *testing.B) { for i := 0; i < b.N; i++ { b.SetBytes(int64(sz)) @@ -280,7 +279,6 @@ func BenchmarkUnmarshalCorpusFile(b *testing.B) { } for sz := 1; sz <= len(buf); sz <<= 1 { - sz := sz data := marshalCorpusFile(buf[:sz]) b.Run(strconv.Itoa(sz), func(b *testing.B) { for i := 0; i < b.N; i++ { diff --git a/src/internal/fuzz/minimize_test.go b/src/internal/fuzz/minimize_test.go index e7e23e5a05..79d986374f 100644 --- a/src/internal/fuzz/minimize_test.go +++ b/src/internal/fuzz/minimize_test.go @@ -132,7 +132,6 @@ func TestMinimizeInput(t *testing.T) { } for _, tc := range cases { - tc := tc t.Run(tc.name, func(t *testing.T) { t.Parallel() ws := &workerServer{ diff --git a/src/internal/fuzz/worker_test.go b/src/internal/fuzz/worker_test.go index d0b21da783..9420248d2c 100644 --- a/src/internal/fuzz/worker_test.go +++ b/src/internal/fuzz/worker_test.go @@ -182,7 +182,6 @@ func BenchmarkWorkerMinimize(b *testing.B) { bytes := make([]byte, 1024) ctx := context.Background() for sz := 1; sz <= len(bytes); sz <<= 1 { - sz := sz input := []any{bytes[:sz]} encodedVals := marshalCorpusFile(input...) mem = <-ws.memMu -- cgit v1.3