rust-lang / rust-lang/rust-clippy
`use_debug` does not work for `format_args!()`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Lint name: use_debug
I tried this code:
fn main() {
format_args!("{:?}", "Hello, world!");
}
I expected to see this happen: the lint should fail, because I am using debug formatting. Actually I am using the log crate and was surprised, that I do not get a warning from clippy. I am just guessing that fixing this for format_args!() also will fix the log!() macros that internally depend on it.
Meta
Rust version (rustc -Vv):
rustc 1.58.0-nightly (936f2600b 2021-11-22)
binary: rustc
commit-hash: 936f2600b6c903b04387f74ed5cbce88bb06d243
commit-date: 2021-11-22
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0
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.
Research direction
Start by reproducing the issue with the provided format_args! example and then trace the use_debug lint entry point in rust-clippy. Check whether the lint sees debug formatting inside format_args! and verify that the expected warning also covers the reported logging-macro case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100