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

lint result.unwrap_or_else(|| value) #5715

Closed
bugadani opened this issue Jun 14, 2020 · 1 comment · Fixed by #5720
Closed

lint result.unwrap_or_else(|| value) #5715

bugadani opened this issue Jun 14, 2020 · 1 comment · Fixed by #5720
Labels
A-lint Area: New lints

Comments

@bugadani
Copy link
Contributor

Most of the result.unwrap_or_else(|| <some value, or object property>) code can be replaced with result.unwrap_or(<some value>). This is mostly a readability issue and probably gives extra work to the inliner/optimizer similar to other redundant closures.

@bugadani
Copy link
Contributor Author

Thinking about this a little, I think I might be able to implement this lint for at least the subset of cases. Unfortunately it doesn't help that clippy::author doesn't expand closures :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants