]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/panic_unimplemented.rs
Auto merge of #79780 - camelid:use-summary_opts, r=GuillaumeGomez
[rust.git] / src / tools / clippy / clippy_lints / src / panic_unimplemented.rs
index 8b10d0716471270fd523fbe32e37317992478a58..359620cc079752b806be469b03505d40aa4a2e1f 100644 (file)
     /// ```
     pub UNREACHABLE,
     restriction,
-    "`unreachable!` should not be present in production code"
+    "usage of the `unreachable!` macro"
 }
 
 declare_lint_pass!(PanicUnimplemented => [UNIMPLEMENTED, UNREACHABLE, TODO, PANIC]);
 
 impl<'tcx> LateLintPass<'tcx> for PanicUnimplemented {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
-        if let Some(_) = match_panic_call(cx, expr) {
+        if match_panic_call(cx, expr).is_some() {
             let span = get_outer_span(expr);
             if is_expn_of(expr.span, "unimplemented").is_some() {
                 span_lint(
@@ -85,12 +85,7 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
             } else if is_expn_of(expr.span, "todo").is_some() {
                 span_lint(cx, TODO, span, "`todo` should not be present in production code");
             } else if is_expn_of(expr.span, "unreachable").is_some() {
-                span_lint(
-                    cx,
-                    UNREACHABLE,
-                    span,
-                    "`unreachable` should not be present in production code",
-                );
+                span_lint(cx, UNREACHABLE, span, "usage of the `unreachable!` macro");
             } else if is_expn_of(expr.span, "panic").is_some() {
                 span_lint(cx, PANIC, span, "`panic` should not be present in production code");
             }