]> git.lizzy.rs Git - rust.git/commitdiff
Add unreachable!() as option
authorA.A.Abroskin <arkweid@evilmartians.com>
Thu, 27 Dec 2018 13:12:11 +0000 (16:12 +0300)
committerArkweid <arkweid@evilmartians.com>
Mon, 7 Jan 2019 10:30:17 +0000 (13:30 +0300)
clippy_lints/src/assert_checks.rs
tests/ui/assert_checks.stderr

index ecd71952b93ca2235d79f82253c4d9273ac67e73..dcc11951b267d06b43117b263a3221dd81dd2bb4 100644 (file)
@@ -32,7 +32,7 @@
 
 /// **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! {
     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 @@ fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
                     },
                     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!()");
                     },
                     _ => (),
                 }
index fd7e4e014201dfeff8e408f2ac8b9d5f320913a3..e203994165061e1ad0b6ec3380d3f569d283dbb3 100644 (file)
@@ -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);