rust-lang / rust-lang/rust-clippy
Lint idea: `missing_panic_message`
@qdot3 is already working on this.
Since Sep 3, 2026.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
What it does
Check if panic!, todo!, unimplemented!, unreachable! have a custom panic message configured (similar to missing_assert_message)
Advantage
-
Code documentation
-
Panic investigation
Could help locating the
panicby using its message on top of the bracktrace.For a software I develop, we use sentry to report error on our rust code (mostly panic)
During one of the panic caused by atodo!, we where not sure from where it was coming from because the backtrace provided by sentry did not contain the line number.The message would have helped to know precisely which
todo!the panic was coming from.
Drawbacks
No response
Example
fn panic_is_not_5(v: u32) {
if v != 5 {
panic!()
}
}
Could be written as:
fn panic_is_not_5(v: u32) {
if v != 5 {
panic!("Called with the value {v} that is not 5")
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.