Auto merge of #6398 - rajcspsg:issue_6357, r=flip1995

issue_6357 update unreachable macro usage

changelog: none
This commit is contained in:
bors 2020-11-28 22:41:28 +00:00
commit bc723c53a0
2 changed files with 6 additions and 11 deletions

View file

@ -66,7 +66,7 @@ declare_clippy_lint! {
/// ```
pub UNREACHABLE,
restriction,
"`unreachable!` should not be present in production code"
"usage of the `unreachable!` macro"
}
declare_lint_pass!(PanicUnimplemented => [UNIMPLEMENTED, UNREACHABLE, TODO, PANIC]);
@ -85,12 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for PanicUnimplemented {
} 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");
}

View file

@ -62,7 +62,7 @@ error: `unimplemented` should not be present in production code
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `unreachable` should not be present in production code
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:32:5
|
LL | unreachable!();
@ -70,7 +70,7 @@ LL | unreachable!();
|
= note: `-D clippy::unreachable` implied by `-D warnings`
error: `unreachable` should not be present in production code
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:33:5
|
LL | unreachable!("message");
@ -78,7 +78,7 @@ LL | unreachable!("message");
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: `unreachable` should not be present in production code
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:34:5
|
LL | unreachable!("{} {}", "panic with", "multiple arguments");
@ -102,7 +102,7 @@ error: `unimplemented` should not be present in production code
LL | unimplemented!();
| ^^^^^^^^^^^^^^^^^
error: `unreachable` should not be present in production code
error: usage of the `unreachable!` macro
--> $DIR/panicking_macros.rs:43:5
|
LL | unreachable!();