Skip to content

Commit 7c389ac

Browse files
committed
Fix error warning span for issue12045
1 parent e899684 commit 7c389ac

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

clippy_lints/src/no_effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn check_no_effect(cx: &LateContext<'_>, stmt: &Stmt<'_>) -> bool {
155155
cx,
156156
NO_EFFECT_UNDERSCORE_BINDING,
157157
init.hir_id,
158-
stmt.span,
158+
ident.span,
159159
"binding to `_` prefixed variable with no side-effect",
160160
);
161161
return true;

tests/ui/no_effect.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,31 +152,31 @@ LL | FooString { s: s };
152152
| ^^^^^^^^^^^^^^^^^^^
153153

154154
error: binding to `_` prefixed variable with no side-effect
155-
--> $DIR/no_effect.rs:175:5
155+
--> $DIR/no_effect.rs:175:9
156156
|
157157
LL | let _unused = 1;
158-
| ^^^^^^^^^^^^^^^^
158+
| ^^^^^^^
159159
|
160160
= note: `-D clippy::no-effect-underscore-binding` implied by `-D warnings`
161161
= help: to override `-D warnings` add `#[allow(clippy::no_effect_underscore_binding)]`
162162

163163
error: binding to `_` prefixed variable with no side-effect
164-
--> $DIR/no_effect.rs:178:5
164+
--> $DIR/no_effect.rs:178:9
165165
|
166166
LL | let _penguin = || println!("Some helpful closure");
167-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167+
| ^^^^^^^^
168168

169169
error: binding to `_` prefixed variable with no side-effect
170-
--> $DIR/no_effect.rs:180:5
170+
--> $DIR/no_effect.rs:180:9
171171
|
172172
LL | let _duck = Struct { field: 0 };
173-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
173+
| ^^^^^
174174

175175
error: binding to `_` prefixed variable with no side-effect
176-
--> $DIR/no_effect.rs:182:5
176+
--> $DIR/no_effect.rs:182:9
177177
|
178178
LL | let _cat = [2, 4, 6, 8][2];
179-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
179+
| ^^^^
180180

181181
error: aborting due to 29 previous errors
182182

0 commit comments

Comments
 (0)