More specific spans for use_debug lint

This commit is contained in:
Jason Newcomb 2021-03-01 13:28:36 -05:00
parent 4450c21f51
commit 4c1047167d
No known key found for this signature in database
GPG key ID: DA59E8643A37ED06
2 changed files with 7 additions and 7 deletions

View file

@ -456,7 +456,7 @@ impl Write {
if !self.in_debug_impl && arg.format.ty == "?" { if !self.in_debug_impl && arg.format.ty == "?" {
// FIXME: modify rustc's fmt string parser to give us the current span // FIXME: modify rustc's fmt string parser to give us the current span
span_lint(cx, USE_DEBUG, str.span, "use of `Debug`-based formatting"); span_lint(cx, USE_DEBUG, span, "use of `Debug`-based formatting");
} }
args.push(arg, span); args.push(arg, span);

View file

@ -1,8 +1,8 @@
error: use of `Debug`-based formatting error: use of `Debug`-based formatting
--> $DIR/print.rs:11:19 --> $DIR/print.rs:11:20
| |
LL | write!(f, "{:?}", 43.1415) LL | write!(f, "{:?}", 43.1415)
| ^^^^^^ | ^^^^
| |
= note: `-D clippy::use-debug` implied by `-D warnings` = note: `-D clippy::use-debug` implied by `-D warnings`
@ -33,10 +33,10 @@ LL | print!("Hello {:?}", "World");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `Debug`-based formatting error: use of `Debug`-based formatting
--> $DIR/print.rs:28:12 --> $DIR/print.rs:28:19
| |
LL | print!("Hello {:?}", "World"); LL | print!("Hello {:?}", "World");
| ^^^^^^^^^^^^ | ^^^^
error: use of `print!` error: use of `print!`
--> $DIR/print.rs:30:5 --> $DIR/print.rs:30:5
@ -45,10 +45,10 @@ LL | print!("Hello {:#?}", "#orld");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: use of `Debug`-based formatting error: use of `Debug`-based formatting
--> $DIR/print.rs:30:12 --> $DIR/print.rs:30:19
| |
LL | print!("Hello {:#?}", "#orld"); LL | print!("Hello {:#?}", "#orld");
| ^^^^^^^^^^^^^ | ^^^^^
error: aborting due to 8 previous errors error: aborting due to 8 previous errors