Skip to content

strings, bytes: Remove unnecessary function literals #26802

@johanbrandhorst

Description

@johanbrandhorst

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions