mirror of https://github.com/gofiber/fiber.git
cleanup: remove unused function `IndexRune`
parent
d0ed605194
commit
f5b7a12d84
|
@ -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.
|
// 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) {
|
func Convert[T any](value string, convertor func(string) (T, error), defaultValue ...T) (T, error) {
|
||||||
converted, err := convertor(value)
|
converted, err := convertor(value)
|
||||||
|
|
|
@ -625,13 +625,13 @@ func Benchmark_SlashRecognition(b *testing.B) {
|
||||||
}
|
}
|
||||||
require.True(b, result)
|
require.True(b, result)
|
||||||
})
|
})
|
||||||
b.Run("IndexRune", func(b *testing.B) {
|
b.Run("strings.ContainsRune", func(b *testing.B) {
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
result = false
|
result = false
|
||||||
c := int32(slashDelimiter)
|
c := int32(slashDelimiter)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
result = IndexRune(search, c)
|
result = strings.ContainsRune(search, c)
|
||||||
}
|
}
|
||||||
require.True(b, result)
|
require.True(b, result)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue