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

redundant_closure should be in the Perf group #3468

Open
asomers opened this issue Nov 29, 2018 · 2 comments
Open

redundant_closure should be in the Perf group #3468

asomers opened this issue Nov 29, 2018 · 2 comments
Labels
A-category Area: Categorization of lints S-needs-discussion Status: Needs further discussion before merging or work can be started

Comments

@asomers
Copy link

asomers commented Nov 29, 2018

The redundant_closure lint should be in the Perf group. All those closures take code space. The optimizer can't combine closures, even if they're identical. (Perhaps it can for Option::map; I haven't checked. But definitely for Future::map it cannot).

> cargo +nightly clippy -V
clippy 0.0.212 (481f7880 2018-10-30)
@Manishearth
Copy link
Member

In most situations they get inlined so it's really about giving the optimizer more work.

@asomers
Copy link
Author

asomers commented Nov 29, 2018

In the case of Future::map they seem to get inlined, but multiple identical closures don't get combined. Perhaps it's because many of the Future::map invocations get inlined too? I don't know. But I do know that eliminating those redundant closures reduces the build size, even with LTO enabled.

@camsteffen camsteffen added A-category Area: Categorization of lints S-needs-discussion Status: Needs further discussion before merging or work can be started labels Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-category Area: Categorization of lints S-needs-discussion Status: Needs further discussion before merging or work can be started
Projects
None yet
Development

No branches or pull requests

3 participants