use testing.B.Loop in all benchmark tests (#5285)

go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./...
was used as a starting point.
This commit is contained in:
Marten Seemann
2025-08-16 12:44:56 +02:00
committed by GitHub
parent 66e5c5ebaa
commit 8c062ae604
13 changed files with 108 additions and 86 deletions

View File

@@ -4,9 +4,11 @@ import "testing"
func BenchmarkRingBuffer(b *testing.B) {
r := RingBuffer[int]{}
b.ResetTimer()
for i := 0; i < b.N; i++ {
r.PushBack(i)
var val int
for b.Loop() {
r.PushBack(val)
r.PopFront()
val++
}
}