Skip to content

Commit 986fdef

Browse files
author
A.A.Abroskin
committed
Add unreachable!() as option
1 parent f04a13c commit 986fdef

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/assert_checks.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ declare_clippy_lint! {
3232

3333
/// **What it does:** Check explicit call assert!(false)
3434
///
35-
/// **Why is this bad?** Should probably be replaced by a panic!()
35+
/// **Why is this bad?** Should probably be replaced by a panic!() or unreachable!()
3636
///
3737
/// **Known problems:** None
3838
///
@@ -43,7 +43,7 @@ declare_clippy_lint! {
4343
declare_clippy_lint! {
4444
pub EXPLICIT_FALSE,
4545
correctness,
46-
"assert!(false) should probably be replaced by a panic!()r"
46+
"assert!(false) should probably be replaced by a panic!() or unreachable!()"
4747
}
4848

4949
pub struct AssertChecks;
@@ -68,7 +68,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertChecks {
6868
},
6969
LitKind::Bool(false) => {
7070
span_lint(cx, EXPLICIT_FALSE, e.span,
71-
"assert!(false) should probably be replaced by a panic!()");
71+
"assert!(false) should probably be replaced by a panic!() or unreachable!()");
7272
},
7373
_ => (),
7474
}

tests/ui/assert_checks.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ error: assert!(true) will be optimized out by the compiler
66
|
77
= note: #[deny(clippy::explicit_true)] on by default
88

9-
error: assert!(false) should probably be replaced by a panic!()
9+
error: assert!(false) should probably be replaced by a panic!() or unreachable!()
1010
--> $DIR/assert_checks.rs:12:5
1111
|
1212
12 | assert!(false);

0 commit comments

Comments
 (0)