Skip to content

Commit

Permalink
Add unreachable!() as option
Browse files Browse the repository at this point in the history
  • Loading branch information
A.A.Abroskin committed Dec 27, 2018
1 parent f04a13c commit 986fdef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions clippy_lints/src/assert_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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;
Expand All @@ -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!()");
},
_ => (),
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/assert_checks.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 986fdef

Please sign in to comment.