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