1
1
use rustc:: lint:: { EarlyContext , EarlyLintPass , LintArray , LintPass } ;
2
2
use rustc:: { declare_tool_lint, lint_array} ;
3
- use crate :: utils:: span_lint ;
3
+ use crate :: utils:: span_lint_and_sugg ;
4
4
use syntax:: ast;
5
+ use rustc_errors:: Applicability ;
5
6
6
- /// **What it does:** Checks for usage of dbg!() macro not to have it in
7
- /// version control.
7
+ /// **What it does:** Checks for usage of dbg!() macro.
8
8
///
9
- /// **Why is this bad?** `dbg!` macro is intended as a debugging tool.
9
+ /// **Why is this bad?** `dbg!` macro is intended as a debugging tool. It
10
+ /// should not be in version control.
10
11
///
11
12
/// **Known problems:** None.
12
13
///
@@ -20,7 +21,7 @@ use syntax::ast;
20
21
/// ```
21
22
declare_clippy_lint ! {
22
23
pub DBG_MACRO ,
23
- style ,
24
+ restriction ,
24
25
"`dbg!` macro is intended as a debugging tool"
25
26
}
26
27
@@ -39,12 +40,16 @@ impl LintPass for Pass {
39
40
40
41
impl EarlyLintPass for Pass {
41
42
fn check_mac ( & mut self , cx : & EarlyContext < ' _ > , mac : & ast:: Mac ) {
43
+ println ! ( "{:?}" , mac) ;
42
44
if mac. node . path == "dbg" {
43
- span_lint (
45
+ span_lint_and_sugg (
44
46
cx,
45
47
DBG_MACRO ,
46
48
mac. span ,
47
- "`dbg!` macro is intended as a debugging tool. ensure to avoid having uses of it in version control" ,
49
+ "`dbg!` macro is intended as a debugging tool" ,
50
+ "ensure to avoid having uses of it in version control" ,
51
+ mac. node . tts , // TODO: to string
52
+ Applicability :: MaybeIncorrect ,
48
53
) ;
49
54
}
50
55
}
0 commit comments