about summary refs log tree commit diff
path: root/compiler/rustc_lint/src
diff options
context:
space:
mode:
authorRyan Levick <ryan.levick@gmail.com>2021-01-08 11:37:52 +0100
committerRyan Levick <me@ryanlevick.com>2021-03-03 11:22:52 +0100
commit217c88655b1155796739edbf415e7ce37d30830b (patch)
tree7ae1bb24e8eb4e8ed865e6f424e9d3ffaa4a7e4e /compiler/rustc_lint/src
parentc5ff54cbdb6b0da742110b416cdbcf0ca0ff0fc4 (diff)
downloadrust-217c88655b1155796739edbf415e7ce37d30830b.tar.gz
rust-217c88655b1155796739edbf415e7ce37d30830b.zip
Improve warning
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()
                                 });
                             }
                         }