Skip to content

Commit 4c10471

Browse files
committed
More specific spans for use_debug lint
1 parent 4450c21 commit 4c10471

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clippy_lints/src/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl Write {
456456

457457
if !self.in_debug_impl && arg.format.ty == "?" {
458458
// FIXME: modify rustc's fmt string parser to give us the current span
459-
span_lint(cx, USE_DEBUG, str.span, "use of `Debug`-based formatting");
459+
span_lint(cx, USE_DEBUG, span, "use of `Debug`-based formatting");
460460
}
461461

462462
args.push(arg, span);

tests/ui/print.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: use of `Debug`-based formatting
2-
--> $DIR/print.rs:11:19
2+
--> $DIR/print.rs:11:20
33
|
44
LL | write!(f, "{:?}", 43.1415)
5-
| ^^^^^^
5+
| ^^^^
66
|
77
= note: `-D clippy::use-debug` implied by `-D warnings`
88

@@ -33,10 +33,10 @@ LL | print!("Hello {:?}", "World");
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3434

3535
error: use of `Debug`-based formatting
36-
--> $DIR/print.rs:28:12
36+
--> $DIR/print.rs:28:19
3737
|
3838
LL | print!("Hello {:?}", "World");
39-
| ^^^^^^^^^^^^
39+
| ^^^^
4040

4141
error: use of `print!`
4242
--> $DIR/print.rs:30:5
@@ -45,10 +45,10 @@ LL | print!("Hello {:#?}", "#orld");
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4646

4747
error: use of `Debug`-based formatting
48-
--> $DIR/print.rs:30:12
48+
--> $DIR/print.rs:30:19
4949
|
5050
LL | print!("Hello {:#?}", "#orld");
51-
| ^^^^^^^^^^^^^
51+
| ^^^^^
5252

5353
error: aborting due to 8 previous errors
5454

0 commit comments

Comments
 (0)