Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strings, bytes: Remove unnecessary function literals #26802

Closed
johanbrandhorst opened this issue Aug 4, 2018 · 1 comment
Closed

strings, bytes: Remove unnecessary function literals #26802

johanbrandhorst opened this issue Aug 4, 2018 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@johanbrandhorst
Copy link
Member

What version of Go are you using (go version)?

tip

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

@quasilyte ran unlambda on the source tree and found the following instances of unnecessary function literals:

$GOROOT/src/hash/fnv/fnv_test.go:114:11: unlambda: replace `func() hash.Hash { return New128() }` with `New128`
$GOROOT/src/hash/fnv/fnv_test.go:115:12: unlambda: replace `func() hash.Hash { return New128a() }` with `New128a`
$GOROOT/src/strings/strings.go:621:13: unlambda: replace `func(r rune) rune { return c.ToUpper(r) }` with `c.ToUpper`
$GOROOT/src/strings/strings.go:627:13: unlambda: replace `func(r rune) rune { return c.ToLower(r) }` with `c.ToLower`
$GOROOT/src/strings/strings.go:633:13: unlambda: replace `func(r rune) rune { return c.ToTitle(r) }` with `c.ToTitle`
$GOROOT/src/bytes/bytes.go:492:13: unlambda: replace `func(r rune) rune { return c.ToUpper(r) }` with `c.ToUpper`
$GOROOT/src/bytes/bytes.go:498:13: unlambda: replace `func(r rune) rune { return c.ToLower(r) }` with `c.ToLower`
$GOROOT/src/bytes/bytes.go:504:13: unlambda: replace `func(r rune) rune { return c.ToTitle(r) }` with `c.ToTitle`

I intend to submit a CL to fix these.

@gopherbot
Copy link

Change https://golang.org/cl/127756 mentions this issue: hash/fnv, strings, bytes: avoid unnecessary function literals

@dsnet dsnet changed the title hash/fnv, strings, bytes: Remove unnecessary function literals strings, bytes: Remove unnecessary function literals Aug 5, 2018
@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 6, 2018
@FiloSottile FiloSottile added this to the Go1.12 milestone Aug 6, 2018
@golang golang locked and limited conversation to collaborators Aug 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants