Skip to content

use_debug does not work for format_args!() #8027

@kamulos

Description

@kamulos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions