Skip to content

Commit bc723c5

Browse files
committed
Auto merge of #6398 - rajcspsg:issue_6357, r=flip1995
issue_6357 update unreachable macro usage changelog: none
2 parents 6cbb093 + 76f2c10 commit bc723c5

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

clippy_lints/src/panic_unimplemented.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ declare_clippy_lint! {
6666
/// ```
6767
pub UNREACHABLE,
6868
restriction,
69-
"`unreachable!` should not be present in production code"
69+
"usage of the `unreachable!` macro"
7070
}
7171

7272
declare_lint_pass!(PanicUnimplemented => [UNIMPLEMENTED, UNREACHABLE, TODO, PANIC]);
@@ -85,12 +85,7 @@ impl<'tcx> LateLintPass<'tcx> for PanicUnimplemented {
8585
} else if is_expn_of(expr.span, "todo").is_some() {
8686
span_lint(cx, TODO, span, "`todo` should not be present in production code");
8787
} else if is_expn_of(expr.span, "unreachable").is_some() {
88-
span_lint(
89-
cx,
90-
UNREACHABLE,
91-
span,
92-
"`unreachable` should not be present in production code",
93-
);
88+
span_lint(cx, UNREACHABLE, span, "usage of the `unreachable!` macro");
9489
} else if is_expn_of(expr.span, "panic").is_some() {
9590
span_lint(cx, PANIC, span, "`panic` should not be present in production code");
9691
}

tests/ui/panicking_macros.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,23 @@ error: `unimplemented` should not be present in production code
6262
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
6363
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6464

65-
error: `unreachable` should not be present in production code
65+
error: usage of the `unreachable!` macro
6666
--> $DIR/panicking_macros.rs:32:5
6767
|
6868
LL | unreachable!();
6969
| ^^^^^^^^^^^^^^^
7070
|
7171
= note: `-D clippy::unreachable` implied by `-D warnings`
7272

73-
error: `unreachable` should not be present in production code
73+
error: usage of the `unreachable!` macro
7474
--> $DIR/panicking_macros.rs:33:5
7575
|
7676
LL | unreachable!("message");
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^
7878
|
7979
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
8080

81-
error: `unreachable` should not be present in production code
81+
error: usage of the `unreachable!` macro
8282
--> $DIR/panicking_macros.rs:34:5
8383
|
8484
LL | unreachable!("{} {}", "panic with", "multiple arguments");
@@ -102,7 +102,7 @@ error: `unimplemented` should not be present in production code
102102
LL | unimplemented!();
103103
| ^^^^^^^^^^^^^^^^^
104104

105-
error: `unreachable` should not be present in production code
105+
error: usage of the `unreachable!` macro
106106
--> $DIR/panicking_macros.rs:43:5
107107
|
108108
LL | unreachable!();

0 commit comments

Comments
 (0)