]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/panic_unimplemented.rs
Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup
[rust.git] / src / tools / clippy / clippy_lints / src / panic_unimplemented.rs
index 10f4694640eed99907d31aedd6ee0beaed624aa7..6379dffd22e372ac8305f8fce41fe8a50ad2e555 100644 (file)
@@ -96,23 +96,20 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if_chain! {
             if let ExprKind::Block(ref block, _) = expr.kind;
             if let Some(ref ex) = block.expr;
-            if let Some(params) = match_function_call(cx, ex, &paths::BEGIN_PANIC);
-            if params.len() == 1;
+            if let Some(params) = match_function_call(cx, ex, &paths::BEGIN_PANIC)
+                .or_else(|| match_function_call(cx, ex, &paths::BEGIN_PANIC_FMT));
             then {
+                let span = get_outer_span(expr);
                 if is_expn_of(expr.span, "unimplemented").is_some() {
-                    let span = get_outer_span(expr);
                     span_lint(cx, UNIMPLEMENTED, span,
                               "`unimplemented` should not be present in production code");
                 } else if is_expn_of(expr.span, "todo").is_some() {
-                    let span = get_outer_span(expr);
                     span_lint(cx, TODO, span,
                               "`todo` should not be present in production code");
                 } else if is_expn_of(expr.span, "unreachable").is_some() {
-                    let span = get_outer_span(expr);
                     span_lint(cx, UNREACHABLE, span,
                               "`unreachable` should not be present in production code");
                 } else if is_expn_of(expr.span, "panic").is_some() {
-                    let span = get_outer_span(expr);
                     span_lint(cx, PANIC, span,
                               "`panic` should not be present in production code");
                     match_panic(params, expr, cx);