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

panic! should not trigger clippy::panic in conditional expressions evaluated at compile-time #8358

Closed
c410-f3r opened this issue Jan 27, 2022 · 1 comment

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented Jan 27, 2022

Code

#![deny(clippy::panic)]

const _N: usize = 1;
const _: () = {
    if _N > 2 {
        panic!("Peek a boo");
    }
};

Output

error: `panic` should not be present in production code
 --> src/lib.rs:6:9
  |
6 |         panic!("Peek a boo");
  |         ^^^^^^^^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> src/lib.rs:1:9
  |
1 | #![deny(clippy::panic)]
  |         ^^^^^^^^^^^^^
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic

error: could not compile `playground` due to previous error
@c410-f3r
Copy link
Contributor Author

c410-f3r commented Apr 5, 2022

Fixed by #8592

Totally forgot about this issue and I guess there are a bunch of other opened issues that are already solved

@c410-f3r c410-f3r closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant