rust-lang / rust-lang/rust-clippy
`clippy::panic`/`clippy::todo`/etc dont trigger when direct argument to macros.
Open
@qdot3 is already working on this.
Since Sep 8, 2026.
C-bug
I-false-negative
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
Seems like the lints against panic-y macros dont trigger when used directly in macros.
Lint Name
clippy::panic
Reproducer
I tried this code:
#![deny(clippy::todo)]
pub fn main() {
println!("{}", todo!("test"));
}
I expected to see this happen: Get a error on the use of todo!
Instead, this happened: only got a clippy::diverging_sub_expression trigger.
if I wrap the todo! in a function call like this the clippy::todo lint fires fine:
#![deny(clippy::todo)]
fn foo(x: &str) -> &str {x}
pub fn main() {
println!("{}", foo(todo!("test")));
}
Version
rustc 1.100.0-nightly (f248f4038 2026-09-05)
binary: rustc
commit-hash: f248f4038796913873f11ca65b1b901e311c8dae
commit-date: 2026-09-05
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
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.