about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--clippy_lints/src/semicolon_if_nothing_returned.rs4
-rw-r--r--tests/ui/semicolon_if_nothing_returned.stderr3
2 files changed, 3 insertions, 4 deletions
diff --git a/clippy_lints/src/semicolon_if_nothing_returned.rs b/clippy_lints/src/semicolon_if_nothing_returned.rs
index 6133e86a26a..839c995e525 100644
--- a/clippy_lints/src/semicolon_if_nothing_returned.rs
+++ b/clippy_lints/src/semicolon_if_nothing_returned.rs
@@ -49,12 +49,12 @@ impl LateLintPass<'_> for SemicolonIfNothingReturned {
                     return;
                 }
 
-                let sugg = sugg::Sugg::hir(cx, &expr, "..");
+                let sugg = sugg::Sugg::hir_with_macro_callsite(cx, &expr, "..");
                 let suggestion = format!("{0};", sugg);
                 span_lint_and_sugg(
                     cx,
                     SEMICOLON_IF_NOTHING_RETURNED,
-                    expr.span,
+                    expr.span.source_callsite(),
                     "consider adding a `;` to the last statement for consistent formatting",
                     "add a `;` here",
                     suggestion,
diff --git a/tests/ui/semicolon_if_nothing_returned.stderr b/tests/ui/semicolon_if_nothing_returned.stderr
index 56211ff7f77..b73f8967538 100644
--- a/tests/ui/semicolon_if_nothing_returned.stderr
+++ b/tests/ui/semicolon_if_nothing_returned.stderr
@@ -2,10 +2,9 @@ error: consider adding a `;` to the last statement for consistent formatting
   --> $DIR/semicolon_if_nothing_returned.rs:8:5
    |
 LL |     println!("Hello")
-   |     ^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^ help: add a `;` here: `println!("Hello");`
    |
    = note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings`
-   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: consider adding a `;` to the last statement for consistent formatting
   --> $DIR/semicolon_if_nothing_returned.rs:12:5