mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
strings, bytes: avoid unnecessary function literals
A number of explicit function literals found through the unlambda linter are removed. Fixes #26802 Change-Id: I0b122bdd95e9cb804c77efe20483fdf681c8154e Reviewed-on: https://go-review.googlesource.com/127756 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
parent
39eda0dac1
commit
841a9136b3
2 changed files with 6 additions and 6 deletions
|
|
@ -489,19 +489,19 @@ func ToTitle(s []byte) []byte { return Map(unicode.ToTitle, s) }
|
||||||
// ToUpperSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
// ToUpperSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
||||||
// upper case, giving priority to the special casing rules.
|
// upper case, giving priority to the special casing rules.
|
||||||
func ToUpperSpecial(c unicode.SpecialCase, s []byte) []byte {
|
func ToUpperSpecial(c unicode.SpecialCase, s []byte) []byte {
|
||||||
return Map(func(r rune) rune { return c.ToUpper(r) }, s)
|
return Map(c.ToUpper, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToLowerSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
// ToLowerSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
||||||
// lower case, giving priority to the special casing rules.
|
// lower case, giving priority to the special casing rules.
|
||||||
func ToLowerSpecial(c unicode.SpecialCase, s []byte) []byte {
|
func ToLowerSpecial(c unicode.SpecialCase, s []byte) []byte {
|
||||||
return Map(func(r rune) rune { return c.ToLower(r) }, s)
|
return Map(c.ToLower, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToTitleSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
// ToTitleSpecial treats s as UTF-8-encoded bytes and returns a copy with all the Unicode letters mapped to their
|
||||||
// title case, giving priority to the special casing rules.
|
// title case, giving priority to the special casing rules.
|
||||||
func ToTitleSpecial(c unicode.SpecialCase, s []byte) []byte {
|
func ToTitleSpecial(c unicode.SpecialCase, s []byte) []byte {
|
||||||
return Map(func(r rune) rune { return c.ToTitle(r) }, s)
|
return Map(c.ToTitle, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSeparator reports whether the rune could mark a word boundary.
|
// isSeparator reports whether the rune could mark a word boundary.
|
||||||
|
|
|
||||||
|
|
@ -606,19 +606,19 @@ func ToTitle(s string) string { return Map(unicode.ToTitle, s) }
|
||||||
// ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
|
// ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their
|
||||||
// upper case using the case mapping specified by c.
|
// upper case using the case mapping specified by c.
|
||||||
func ToUpperSpecial(c unicode.SpecialCase, s string) string {
|
func ToUpperSpecial(c unicode.SpecialCase, s string) string {
|
||||||
return Map(func(r rune) rune { return c.ToUpper(r) }, s)
|
return Map(c.ToUpper, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their
|
// ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their
|
||||||
// lower case using the case mapping specified by c.
|
// lower case using the case mapping specified by c.
|
||||||
func ToLowerSpecial(c unicode.SpecialCase, s string) string {
|
func ToLowerSpecial(c unicode.SpecialCase, s string) string {
|
||||||
return Map(func(r rune) rune { return c.ToLower(r) }, s)
|
return Map(c.ToLower, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their
|
// ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their
|
||||||
// title case, giving priority to the special casing rules.
|
// title case, giving priority to the special casing rules.
|
||||||
func ToTitleSpecial(c unicode.SpecialCase, s string) string {
|
func ToTitleSpecial(c unicode.SpecialCase, s string) string {
|
||||||
return Map(func(r rune) rune { return c.ToTitle(r) }, s)
|
return Map(c.ToTitle, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// isSeparator reports whether the rune could mark a word boundary.
|
// isSeparator reports whether the rune could mark a word boundary.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue