1 use rustc::lint::{EarlyContext, EarlyLintPass, LintArray, LintPass};
2 use rustc::{declare_tool_lint, lint_array};
3 use crate::utils::span_lint_and_sugg;
5 use rustc_errors::Applicability;
7 /// **What it does:** Checks for usage of dbg!() macro.
9 /// **Why is this bad?** `dbg!` macro is intended as a debugging tool. It
10 /// should not be in version control.
12 /// **Known problems:** None.
22 declare_clippy_lint! {
25 "`dbg!` macro is intended as a debugging tool"
28 #[derive(Copy, Clone, Debug)]
31 impl LintPass for Pass {
32 fn get_lints(&self) -> LintArray {
33 lint_array!(DBG_MACRO)
36 fn name(&self) -> &'static str {
41 impl EarlyLintPass for Pass {
42 fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
43 if mac.node.path == "dbg" {
48 "`dbg!` macro is intended as a debugging tool",
49 "ensure to avoid having uses of it in version control",
50 mac.node.tts.to_string(),
51 Applicability::MaybeIncorrect,