From 986fdef103dab001b7a3fea93c257d02391bbb9d Mon Sep 17 00:00:00 2001 From: "A.A.Abroskin" Date: Thu, 27 Dec 2018 16:12:11 +0300 Subject: [PATCH] Add unreachable!() as option --- clippy_lints/src/assert_checks.rs | 6 +++--- tests/ui/assert_checks.stderr | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/assert_checks.rs b/clippy_lints/src/assert_checks.rs index ecd71952b93c..dcc11951b267 100644 --- a/clippy_lints/src/assert_checks.rs +++ b/clippy_lints/src/assert_checks.rs @@ -32,7 +32,7 @@ declare_clippy_lint! { /// **What it does:** Check explicit call assert!(false) /// -/// **Why is this bad?** Should probably be replaced by a panic!() +/// **Why is this bad?** Should probably be replaced by a panic!() or unreachable!() /// /// **Known problems:** None /// @@ -43,7 +43,7 @@ declare_clippy_lint! { declare_clippy_lint! { pub EXPLICIT_FALSE, correctness, - "assert!(false) should probably be replaced by a panic!()r" + "assert!(false) should probably be replaced by a panic!() or unreachable!()" } pub struct AssertChecks; @@ -68,7 +68,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertChecks { }, LitKind::Bool(false) => { span_lint(cx, EXPLICIT_FALSE, e.span, - "assert!(false) should probably be replaced by a panic!()"); + "assert!(false) should probably be replaced by a panic!() or unreachable!()"); }, _ => (), } diff --git a/tests/ui/assert_checks.stderr b/tests/ui/assert_checks.stderr index fd7e4e014201..e20399416506 100644 --- a/tests/ui/assert_checks.stderr +++ b/tests/ui/assert_checks.stderr @@ -6,7 +6,7 @@ error: assert!(true) will be optimized out by the compiler | = note: #[deny(clippy::explicit_true)] on by default -error: assert!(false) should probably be replaced by a panic!() +error: assert!(false) should probably be replaced by a panic!() or unreachable!() --> $DIR/assert_checks.rs:12:5 | 12 | assert!(false);