@@ -57,6 +57,22 @@ declare_clippy_lint! {
5757 "`unimplemented!` should not be present in production code"
5858}
5959
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+
6076declare_clippy_lint ! {
6177 /// **What it does:** Checks for usage of `unreachable!`.
6278 ///
@@ -73,7 +89,7 @@ declare_clippy_lint! {
7389 "`unreachable!` should not be present in production code"
7490}
7591
76- declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE ] ) ;
92+ declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE , TODO , PANIC ] ) ;
7793
7894impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for PanicUnimplemented {
7995 fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , expr : & ' tcx Expr ) {
@@ -87,6 +103,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PanicUnimplemented {
87103 let span = get_outer_span( expr) ;
88104 span_lint( cx, UNIMPLEMENTED , span,
89105 "`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" ) ;
90110 } else if is_expn_of( expr. span, "unreachable" ) . is_some( ) {
91111 let span = get_outer_span( expr) ;
92112 span_lint( cx, UNREACHABLE , span,
@@ -95,7 +115,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PanicUnimplemented {
95115 let span = get_outer_span( expr) ;
96116 span_lint( cx, PANIC , span,
97117 "`panic` should not be present in production code" ) ;
98- //} else {
99118 match_panic( params, expr, cx) ;
100119 }
101120 }
0 commit comments