diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2021-03-01 13:28:36 -0500 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2021-03-16 12:10:40 -0400 |
| commit | 4c1047167d20460dcb84e3d947787ce91d5fd0d4 (patch) | |
| tree | a37040a58390c8aeed4d833ae2e742da30d488ac | |
| parent | 4450c21f5125c363397d87ff74ed1a1d52a9f1a8 (diff) | |
| download | rust-4c1047167d20460dcb84e3d947787ce91d5fd0d4.tar.gz rust-4c1047167d20460dcb84e3d947787ce91d5fd0d4.zip | |
More specific spans for `use_debug` lint
| -rw-r--r-- | clippy_lints/src/write.rs | 2 | ||||
| -rw-r--r-- | tests/ui/print.stderr | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index b5470c3bc70..210ddc7465f 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -456,7 +456,7 @@ impl Write { if !self.in_debug_impl && arg.format.ty == "?" { // 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); diff --git a/tests/ui/print.stderr b/tests/ui/print.stderr index 208d9532628..1754c418381 100644 --- a/tests/ui/print.stderr +++ b/tests/ui/print.stderr @@ -1,8 +1,8 @@ error: use of `Debug`-based formatting - --> $DIR/print.rs:11:19 + --> $DIR/print.rs:11:20 | LL | write!(f, "{:?}", 43.1415) - | ^^^^^^ + | ^^^^ | = note: `-D clippy::use-debug` implied by `-D warnings` @@ -33,10 +33,10 @@ LL | print!("Hello {:?}", "World"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> $DIR/print.rs:28:12 + --> $DIR/print.rs:28:19 | LL | print!("Hello {:?}", "World"); - | ^^^^^^^^^^^^ + | ^^^^ error: use of `print!` --> $DIR/print.rs:30:5 @@ -45,10 +45,10 @@ LL | print!("Hello {:#?}", "#orld"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of `Debug`-based formatting - --> $DIR/print.rs:30:12 + --> $DIR/print.rs:30:19 | LL | print!("Hello {:#?}", "#orld"); - | ^^^^^^^^^^^^^ + | ^^^^^ error: aborting due to 8 previous errors |
