Skip to content

Commit 6b4789d

Browse files
committed
Fixed suggestion in macro invocations
1 parent f1c1584 commit 6b4789d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clippy_lints/src/semicolon_if_nothing_returned.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ impl LateLintPass<'_> for SemicolonIfNothingReturned {
4949
return;
5050
}
5151

52-
let sugg = sugg::Sugg::hir(cx, &expr, "..");
52+
let sugg = sugg::Sugg::hir_with_macro_callsite(cx, &expr, "..");
5353
let suggestion = format!("{0};", sugg);
5454
span_lint_and_sugg(
5555
cx,
5656
SEMICOLON_IF_NOTHING_RETURNED,
57-
expr.span,
57+
expr.span.source_callsite(),
5858
"consider adding a `;` to the last statement for consistent formatting",
5959
"add a `;` here",
6060
suggestion,

tests/ui/semicolon_if_nothing_returned.stderr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ error: consider adding a `;` to the last statement for consistent formatting
22
--> $DIR/semicolon_if_nothing_returned.rs:8:5
33
|
44
LL | println!("Hello")
5-
| ^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");`
66
|
77
= note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings`
8-
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
98

109
error: consider adding a `;` to the last statement for consistent formatting
1110
--> $DIR/semicolon_if_nothing_returned.rs:12:5

0 commit comments

Comments
 (0)