Skip to content

New Lint: Warn dbg!() macro use #3721

Closed
@rhysd

Description

@rhysd

At Rust v1.32, dbg! macro was added.

https://doc.rust-lang.org/std/macro.dbg.html

This macro is supposed to be used for print debugging. So it should not be contained in final code (e.g. when git commit).

From doc, it says:

Note that the macro is intended as a debugging tool and therefore you should avoid having uses of it in version control for longer periods. Use cases involving debug output that should be added to version control may be better served by macros such as debug! from the log crate.

I want to suggest to make clippy warn dbg!() macro use in code.

As related works, eslint, most popular linter for JavaScript, has rule no-console which prevents use of console.log.

https://eslint.org/docs/rules/no-console

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-unnecessaryLint: Warn about unnecessary codeT-macrosType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions