Skip to content

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

@c410-f3r

Description

@c410-f3r

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions