about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-05-05 14:44:32 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2021-05-05 15:03:14 -0500
commit2b38399920ad97cc9db61e50549fd4af54d4b38d (patch)
treec969a47fe08df3d61dc424d5c7d832a750d2e714
parenta8f28b636515cd859d8c9cc78dd17794f8a3c0ad (diff)
downloadrust-2b38399920ad97cc9db61e50549fd4af54d4b38d.tar.gz
rust-2b38399920ad97cc9db61e50549fd4af54d4b38d.zip
Improve eval_order_dependence output
-rw-r--r--clippy_lints/src/eval_order_dependence.rs2
-rw-r--r--tests/ui/eval_order_dependence.stderr8
2 files changed, 5 insertions, 5 deletions
diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs
index 762f64fe37a..8815ca27494 100644
--- a/clippy_lints/src/eval_order_dependence.rs
+++ b/clippy_lints/src/eval_order_dependence.rs
@@ -305,7 +305,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
                     self.cx,
                     EVAL_ORDER_DEPENDENCE,
                     expr.span,
-                    "unsequenced read of a variable",
+                    &format!("unsequenced read of `{}`", self.cx.tcx.hir().name(self.var)),
                     Some(self.write_expr.span),
                     "whether read occurs before this write depends on evaluation order",
                 );
diff --git a/tests/ui/eval_order_dependence.stderr b/tests/ui/eval_order_dependence.stderr
index 8f4fa2228f7..cf4adbdfa24 100644
--- a/tests/ui/eval_order_dependence.stderr
+++ b/tests/ui/eval_order_dependence.stderr
@@ -1,4 +1,4 @@
-error: unsequenced read of a variable
+error: unsequenced read of `x`
   --> $DIR/eval_order_dependence.rs:15:9
    |
 LL |     } + x;
@@ -11,7 +11,7 @@ note: whether read occurs before this write depends on evaluation order
 LL |         x = 1;
    |         ^^^^^
 
-error: unsequenced read of a variable
+error: unsequenced read of `x`
   --> $DIR/eval_order_dependence.rs:18:5
    |
 LL |     x += {
@@ -23,7 +23,7 @@ note: whether read occurs before this write depends on evaluation order
 LL |         x = 20;
    |         ^^^^^^
 
-error: unsequenced read of a variable
+error: unsequenced read of `x`
   --> $DIR/eval_order_dependence.rs:31:12
    |
 LL |         a: x,
@@ -35,7 +35,7 @@ note: whether read occurs before this write depends on evaluation order
 LL |             x = 6;
    |             ^^^^^
 
-error: unsequenced read of a variable
+error: unsequenced read of `x`
   --> $DIR/eval_order_dependence.rs:40:9
    |
 LL |         x += {