diff --git a/tests/ui/{literal_string_with_formatting_args}.rs b/tests/ui/{literal_string_with_formatting_args}.rs index 8a06d0c7b360..0f5b36e67503 100644 --- a/tests/ui/{literal_string_with_formatting_args}.rs +++ b/tests/ui/{literal_string_with_formatting_args}.rs @@ -2,6 +2,38 @@ // The `dbg` macro generates a literal with the name of the current file, so // we need to ensure the lint is not emitted in this case. +// Clippy sets `-Zflatten_format_args=no`, which changes the default behavior of how format args +// are lowered and only that one has this non-macro span. Adding the flag makes it repro on +// godbolt and shows a root context span for the file name string. +// +// So instead of having: +// +// ``` +// Lit( +// Spanned { +// node: Str( +// "[/app/example.rs:2:5] \"something\" = ", +// Cooked, +// ), +// span: /rustc/eb54a50837ad4bcc9842924f27e7287ca66e294c/library/std/src/macros.rs:365:35: 365:58 (#4), +// }, +// ), +// ``` +// +// We get: +// +// ``` +// Lit( +// Spanned { +// node: Str( +// "/app/example.rs", +// Cooked, +// ), +// span: /app/example.rs:2:5: 2:22 (#0), +// }, +// ) +// ``` + #![crate_name = "foo"] #![allow(unused)] #![warn(clippy::literal_string_with_formatting_args)]