about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_lint/src')
-rw-r--r--compiler/rustc_lint/src/noop_method_call.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs
index dad557128f8..b9b5009d9dd 100644
--- a/compiler/rustc_lint/src/noop_method_call.rs
+++ b/compiler/rustc_lint/src/noop_method_call.rs
@@ -70,11 +70,13 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
                             .iter()
                             .any(|s| cx.tcx.is_diagnostic_item(*s, i.def_id()))
                             {
-                                let span = expr.span;
+                                let expr_span = expr.span;
 
-                                cx.struct_span_lint(NOOP_METHOD_CALL, span, |lint| {
-                                    let message = "call to noop method";
-                                    lint.build(&message).emit()
+                                cx.struct_span_lint(NOOP_METHOD_CALL, expr_span, |lint| {
+                                    let message = "call to method that does nothing";
+                                    lint.build(&message)
+                                        .span_label(expr_span, "unnecessary method call")
+                                        .emit()
                                 });
                             }
                         }