Skip to content

Commit 00104a4

Browse files
Add more detailed explanations for #13885 regression test
1 parent a7fb37c commit 00104a4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/ui/{literal_string_with_formatting_args}.rs

+32
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,38 @@
22
// The `dbg` macro generates a literal with the name of the current file, so
33
// we need to ensure the lint is not emitted in this case.
44

5+
// Clippy sets `-Zflatten_format_args=no`, which changes the default behavior of how format args
6+
// are lowered and only that one has this non-macro span. Adding the flag makes it repro on
7+
// godbolt and shows a root context span for the file name string.
8+
//
9+
// So instead of having:
10+
//
11+
// ```
12+
// Lit(
13+
// Spanned {
14+
// node: Str(
15+
// "[/app/example.rs:2:5] \"something\" = ",
16+
// Cooked,
17+
// ),
18+
// span: /rustc/eb54a50837ad4bcc9842924f27e7287ca66e294c/library/std/src/macros.rs:365:35: 365:58 (#4),
19+
// },
20+
// ),
21+
// ```
22+
//
23+
// We get:
24+
//
25+
// ```
26+
// Lit(
27+
// Spanned {
28+
// node: Str(
29+
// "/app/example.rs",
30+
// Cooked,
31+
// ),
32+
// span: /app/example.rs:2:5: 2:22 (#0),
33+
// },
34+
// )
35+
// ```
36+
537
#![crate_name = "foo"]
638
#![allow(unused)]
739
#![warn(clippy::literal_string_with_formatting_args)]

0 commit comments

Comments
 (0)