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 suggestion: Warn if non-trivial work is done inside .expect #2338

Closed
Rufflewind opened this issue Jan 7, 2018 · 3 comments
Closed

Lint suggestion: Warn if non-trivial work is done inside .expect #2338

Rufflewind opened this issue Jan 7, 2018 · 3 comments
Labels
good-first-issue These issues are a good way to get started with Clippy L-perf Lint: Belongs in the perf lint group T-middle Type: Probably requires verifiying types

Comments

@Rufflewind
Copy link

Suggestion: It would be useful to issue warnings for cases like .expect(&format!(…)) that, although correct, are often slower than one would expect because the format! occurs regardless of whether the error message is needed.

@oli-obk oli-obk added L-perf Lint: Belongs in the perf lint group T-middle Type: Probably requires verifiying types good-first-issue These issues are a good way to get started with Clippy labels Jan 8, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Jan 8, 2018

This is a natural extension to the or_fun_call lint

@theotherphil
Copy link
Contributor

theotherphil commented Jan 14, 2018

I'd like to have a go at this.

Should we suggest unwrap_or_else(|e| panic!(...)) as a replacement?

@oli-obk
Copy link
Contributor

oli-obk commented Jun 11, 2018

This has been fixed in #2815

@oli-obk oli-obk closed this as completed Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue These issues are a good way to get started with Clippy L-perf Lint: Belongs in the perf lint group T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

3 participants