Skip to content

Commit 2b38399

Browse files
committed
Improve eval_order_dependence output
1 parent a8f28b6 commit 2b38399

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/eval_order_dependence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
305305
self.cx,
306306
EVAL_ORDER_DEPENDENCE,
307307
expr.span,
308-
"unsequenced read of a variable",
308+
&format!("unsequenced read of `{}`", self.cx.tcx.hir().name(self.var)),
309309
Some(self.write_expr.span),
310310
"whether read occurs before this write depends on evaluation order",
311311
);

tests/ui/eval_order_dependence.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unsequenced read of a variable
1+
error: unsequenced read of `x`
22
--> $DIR/eval_order_dependence.rs:15:9
33
|
44
LL | } + x;
@@ -11,7 +11,7 @@ note: whether read occurs before this write depends on evaluation order
1111
LL | x = 1;
1212
| ^^^^^
1313

14-
error: unsequenced read of a variable
14+
error: unsequenced read of `x`
1515
--> $DIR/eval_order_dependence.rs:18:5
1616
|
1717
LL | x += {
@@ -23,7 +23,7 @@ note: whether read occurs before this write depends on evaluation order
2323
LL | x = 20;
2424
| ^^^^^^
2525

26-
error: unsequenced read of a variable
26+
error: unsequenced read of `x`
2727
--> $DIR/eval_order_dependence.rs:31:12
2828
|
2929
LL | a: x,
@@ -35,7 +35,7 @@ note: whether read occurs before this write depends on evaluation order
3535
LL | x = 6;
3636
| ^^^^^
3737

38-
error: unsequenced read of a variable
38+
error: unsequenced read of `x`
3939
--> $DIR/eval_order_dependence.rs:40:9
4040
|
4141
LL | x += {

0 commit comments

Comments
 (0)