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 lint doesn't catch panics with formatting #5767

Closed
paulkernfeld opened this issue Jul 5, 2020 · 3 comments
Closed

Panic lint doesn't catch panics with formatting #5767

paulkernfeld opened this issue Jul 5, 2020 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@paulkernfeld
Copy link

It looks to me like the panic lint doesn't catch panics with formatting. Although maybe this is intentional, I would expect it to treat panics with and without formatting the same way.

I tried this code:

#[deny(clippy::panic)]
pub fn main() {
    panic!("{}", "This is a panic");
}

I expected to cargo clippy to fail on this code, but it passes.

Meta

  • cargo clippy -V: clippy 0.0.212 (bb37a0f 2020-06-16)
  • rustc -Vv:
rustc 1.44.1 (c7087fe00 2020-06-17)
binary: rustc
commit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7
commit-date: 2020-06-17
host: x86_64-apple-darwin
release: 1.44.1
LLVM version: 9.0
@paulkernfeld paulkernfeld added the C-bug Category: Clippy is not doing the correct thing label Jul 5, 2020
@flip1995 flip1995 added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Jul 13, 2020
@JarredAllen
Copy link
Contributor

I should be able to fix this.

@flip1995
Copy link
Member

This might be related to #3528

bors added a commit that referenced this issue Jul 17, 2020
Panic multiple args

changelog: Fixes bug with `panic` lint reported in #5767. I also did the same changes to the lints for `todo`, `unimplemented` and `unreachable`, so those lints should now also detect calls to those macros with a message.
@JarredAllen
Copy link
Contributor

I believe this can be closed, as my PR resolved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

No branches or pull requests

3 participants