@@ -58,6 +58,22 @@ declare_clippy_lint! {
5858 "`unimplemented!` should not be present in production code"
5959}
6060
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+
6177declare_clippy_lint ! {
6278 /// **What it does:** Checks for usage of `unreachable!`.
6379 ///
@@ -74,7 +90,7 @@ declare_clippy_lint! {
7490 "`unreachable!` should not be present in production code"
7591}
7692
77- declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE ] ) ;
93+ declare_lint_pass ! ( PanicUnimplemented => [ PANIC_PARAMS , UNIMPLEMENTED , UNREACHABLE , TODO , PANIC ] ) ;
7894
7995impl < ' a , ' tcx > LateLintPass < ' a , ' tcx > for PanicUnimplemented {
8096 fn check_expr ( & mut self , cx : & LateContext < ' a , ' tcx > , expr : & ' tcx Expr ) {
@@ -91,6 +107,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PanicUnimplemented {
91107 let span = get_outer_span( expr) ;
92108 span_lint( cx, UNIMPLEMENTED , span,
93109 "`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" ) ;
94114 } else if is_expn_of( expr. span, "unreachable" ) . is_some( ) {
95115 let span = get_outer_span( expr) ;
96116 span_lint( cx, UNREACHABLE , span,
0 commit comments