Skip to content

Commit

Permalink
Improve eval_order_dependence output
Browse files Browse the repository at this point in the history
  • Loading branch information
camsteffen committed May 5, 2021
1 parent a8f28b6 commit 2b38399
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/eval_order_dependence.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unsequenced read of a variable
error: unsequenced read of `x`
--> $DIR/eval_order_dependence.rs:15:9
|
LL | } + x;
Expand All @@ -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 += {
Expand All @@ -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,
Expand All @@ -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 += {
Expand Down

0 comments on commit 2b38399

Please sign in to comment.