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

Add a lint for panic! being used #2297

Closed
sgrif opened this issue Dec 23, 2017 · 1 comment
Closed

Add a lint for panic! being used #2297

sgrif opened this issue Dec 23, 2017 · 1 comment
Labels
A-lint Area: New lints T-macros Type: Issues with macros and macro expansion

Comments

@sgrif
Copy link

sgrif commented Dec 23, 2017

Given that there's a lint for Result::unwrap and Option::unwrap being used, I was surprised that this wasn't present.

@phansch phansch added A-lint Area: New lints T-macros Type: Issues with macros and macro expansion L-suggestion Lint: Improving, adding or fixing lint suggestions and removed L-suggestion Lint: Improving, adding or fixing lint suggestions labels Apr 4, 2018
@y21
Copy link
Member

y21 commented Oct 5, 2024

This lint exists today (along with lints for all the other kinds of panic-like macros).

#[warn(clippy::panic)]
fn f() {
    panic!();
}
warning: `panic` should not be present in production code
 --> src/main.rs:3:5
  |
3 |     panic!();
  |     ^^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic

@y21 y21 closed this as completed Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

No branches or pull requests

3 participants