From f5b7a12d848427f6a40876f5c16670e3bf5f1303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Thu, 30 Jan 2025 16:50:20 +0100 Subject: [PATCH] cleanup: remove unused function `IndexRune` --- helpers.go | 9 --------- helpers_test.go | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/helpers.go b/helpers.go index 04a1da6907..a400be0d42 100644 --- a/helpers.go +++ b/helpers.go @@ -728,15 +728,6 @@ func IsMethodIdempotent(m string) bool { } } -func IndexRune(str string, needle int32) bool { - for _, b := range str { - if b == needle { - return true - } - } - return false -} - // Convert a string value to a specified type, handling errors and optional default values. func Convert[T any](value string, convertor func(string) (T, error), defaultValue ...T) (T, error) { converted, err := convertor(value) diff --git a/helpers_test.go b/helpers_test.go index a3f631bbfd..75698d8794 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -625,13 +625,13 @@ func Benchmark_SlashRecognition(b *testing.B) { } require.True(b, result) }) - b.Run("IndexRune", func(b *testing.B) { + b.Run("strings.ContainsRune", func(b *testing.B) { b.ReportAllocs() b.ResetTimer() result = false c := int32(slashDelimiter) for i := 0; i < b.N; i++ { - result = IndexRune(search, c) + result = strings.ContainsRune(search, c) } require.True(b, result) })