@@ -57,6 +57,22 @@ declare_clippy_lint! {
57
57
"`unimplemented!` should not be present in production code"
58
58
}
59
59
60
+ declare_clippy_lint ! {
61
+ /// **What it does:** Checks for usage of `todo!`.
62
+ ///
63
+ /// **Why is this bad?** This macro should not be present in production code
64
+ ///
65
+ /// **Known problems:** None.
66
+ ///
67
+ /// **Example:**
68
+ /// ```no_run
69
+ /// todo!();
70
+ /// ```
71
+ pub TODO ,
72
+ restriction,
73
+ "`todo!` should not be present in production code"
74
+ }
75
+
60
76
declare_clippy_lint ! {
61
77
/// **What it does:** Checks for usage of `unreachable!`.
62
78
///
@@ -73,7 +89,7 @@ declare_clippy_lint! {
73
89
"`unreachable!` should not be present in production code"
74
90
}
75
91
76
- declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE ] ) ;
92
+ declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE , TODO , PANIC ] ) ;
77
93
78
94
impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for PanicUnimplemented {
79
95
fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , expr : & ' tcx Expr ) {
@@ -87,6 +103,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PanicUnimplemented {
87
103
let span = get_outer_span( expr) ;
88
104
span_lint( cx, UNIMPLEMENTED , span,
89
105
"`unimplemented` should not be present in production code" ) ;
106
+ } else if is_expn_of( expr. span, "todo" ) . is_some( ) {
107
+ let span = get_outer_span( expr) ;
108
+ span_lint( cx, TODO , span,
109
+ "`todo` should not be present in production code" ) ;
90
110
} else if is_expn_of( expr. span, "unreachable" ) . is_some( ) {
91
111
let span = get_outer_span( expr) ;
92
112
span_lint( cx, UNREACHABLE , span,
0 commit comments