Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly export core and std macros #139493

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Voultapher
Copy link
Contributor

@Voultapher Voultapher commented Apr 7, 2025

Currently all core and std macros are automatically added to the prelude via #[macro_use]. However a situation arose where we want to add a new macro assert_matches but don't want to pull it into the standard prelude for compatibility reasons. By explicitly exporting the macros found in the core and std crates we get to decide on a per macro basis and can later add them via the rust_20xx preludes.

Unlocks #137487

Currently all core and std macros are automatically added to the prelude
via #[macro_use]. However a situation arose where we want to add a new macro
`assert_matches` but don't want to pull it into the standard prelude for
compatibility reasons. By explicitly exporting the macros found in the core and
std crates we get to decide on a per macro basis and can later add them via
the rust_20xx preludes.
@rustbot
Copy link
Collaborator

rustbot commented Apr 7, 2025

r? @ChrisDenton

rustbot has assigned @ChrisDenton.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 7, 2025
@Voultapher
Copy link
Contributor Author

r? @Amanieu

@rust-log-analyzer

This comment has been minimized.


use super::*;
// Explicit import to avoid macro namespace collision.
use super::{arena, client, DecodeMut, Encode, fxhash, Mark, Marked, Reader, server, Unmark, Writer};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What collision is this? Is this something that user code is likely to encounter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the error that I get when not making this change:

error[E0659]: `panic` is ambiguous
   --> library/proc_macro/src/bridge/symbol.rs:41:17
    |
41  |                 panic!("`{}` cannot be a raw identifier", string);
    |                 ^^^^^ ambiguous name
    |
    = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
note: `panic` could refer to the macro imported here
   --> library/proc_macro/src/bridge/symbol.rs:19:5
    |
19  | use super::*;
    |     ^^^^^^^^
    = help: consider adding an explicit import of `panic` to disambiguate
    = help: or use `self::panic` to refer to this macro unambiguously
note: `panic` could also refer to the macro defined here
   --> /rust/library/std/src/prelude/mod.rs:157:13
    |
157 |     pub use super::v1::*;
    |             ^^^^^^^^^

My reasoning is a follows, this special proc macro is built together with std which gives access to std via super, causing the import ambiguity. I don't think this is an issue for user code since normal crates can't access std via super - I checked - and I assume normal proc macros can't either, but I'm no expert in that area.

@rust-log-analyzer

This comment has been minimized.

@Voultapher
Copy link
Contributor Author

@Amanieu the tidy issue highlights an annoying and unforeseen side-effect of this change. The vec module is now part of the prelude. In effect this means that for example this code:

fn xx(i: vec::IntoIter<i32>) {
    let _ = i.as_slice();
}

fn main() {}

that currently doesn't compile on stable would now compile. Initially I thought this would cause name collisions if users define their own vec module but so far I wasn't able to produce those, it seems to always prefer the local module. But regardless, I think we don't want to allow access to a standard library namespace without going through std, alloc or core. AFAIK there is no way to pub use only the macro and not the module namespace without modifications. I have two ideas how to tackle this, maybe we can rename vec to vec_xx internally and have separate use expressions or we have to add another crate that we can #[macro_use] inject into the prelude that only contains the vec macro. Thoughts?

@traviscross
Copy link
Contributor

@petrochenkov
Copy link
Contributor

There's an issue for this change - #53977.

@dtolnay
Copy link
Member

dtolnay commented Apr 8, 2025

@Voultapher, avoiding the vec module re-export can be done like this:

#[macro_export]
macro_rules! myvec {
    () => {};
}

pub mod myvec {
    pub struct Vec;
}

pub mod prelude {
    // Bad: re-exports both macro and type namespace
    // pub use crate::myvec;
    
    mod vec_macro_only {
        #[allow(hidden_glob_reexports)]
        mod myvec {}
        pub use crate::*;
    }
    pub use self::vec_macro_only::myvec;
}

fn main() {
    prelude::myvec!();
    let _: prelude::myvec::Vec; // error
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5e50828c593e04ba0e98f48c9d8696b4

@Voultapher
Copy link
Contributor Author

I've applied the suggestion by @dtolnay local tests seem promising. @Kobzol could we please do a timer run to see if this PR impacts compile-times.

@petrochenkov
Copy link
Contributor

env and panic (and maybe something else now?) need to be treated in the same way as vec.

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 8, 2025

@Voultapher Based on the CI failure I think that a try build would fail now.

@Voultapher
Copy link
Contributor Author

Ok, I'll try to get the CI passing first.

@Voultapher
Copy link
Contributor Author

@petrochenkov I went through all macros and searched the docs and env and panic seem to be the only other ones affected.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/ref_option/ref_option.all.fixed ... ok
tests/ui/non_std_lazy_static/non_std_lazy_static_fixable.fixed ... ok

FAILED TEST: tests/ui/format_args_unfixable.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-d66901fcf071c39e.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-299b005361846292.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c9d012fa1351c9a1.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-6ae23cd7ef138de2.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d494e6b7c1a6e89b.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-d4e4179d28fd4b4c.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-95eabeacab2cfa43.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-1717c86f14e427fe.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-75c78277780d7d9c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-37f19c6bbbc5eedb.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-b4ef3187156cf2a5.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0086164b4f00891f.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-ab47290081742c1b.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/format_args_unfixable.rs" "--edition" "2021"

error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/format_args_unfixable.stderr` to the actual output
--- tests/ui/format_args_unfixable.stderr
+++ <stderr output>
---

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:29:5
   |
LL |     println!("{}: {}", error, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:32:5
   |
LL |     println!("{:?}: {}", error, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:35:5
   |
LL |     println!("{{}}: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:38:5
   |
LL |     println!(r#"error: "{}""#, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:41:5
   |
LL |     println!("error: {}", format!(r#"something failed at "{}""#, Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:44:5
   |
LL |     println!("error: {}", format!("something failed at {} {0}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

---
LL | |         format!("something failed at {}", Location::caller())
LL | |     );
   | |_____^
   |
   = help: combine the `format!(..)` arguments with the outer `write!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `writeln!` args
##[error]  --> tests/ui/format_args_unfixable.rs:56:13
   |
LL |       let _ = writeln!(
---
LL | |         format!("something failed at {}", Location::caller())
LL | |     );
   | |_____^
   |
   = help: combine the `format!(..)` arguments with the outer `writeln!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `print!` args
##[error]  --> tests/ui/format_args_unfixable.rs:62:5
   |
LL |     print!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `print!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `eprint!` args
##[error]  --> tests/ui/format_args_unfixable.rs:65:5
   |
LL |     eprint!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `eprint!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `eprintln!` args
##[error]  --> tests/ui/format_args_unfixable.rs:68:5
   |
LL |     eprintln!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `eprintln!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `format_args!` args
##[error]  --> tests/ui/format_args_unfixable.rs:71:13
   |
LL |     let _ = format_args!("error: {}", format!("something failed at {}", Location::caller()));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `format_args!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert!` args
##[error]  --> tests/ui/format_args_unfixable.rs:74:5
   |
LL |     assert!(true, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert_eq!` args
##[error]  --> tests/ui/format_args_unfixable.rs:77:5
   |
LL |     assert_eq!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert_eq!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert_ne!` args
##[error]  --> tests/ui/format_args_unfixable.rs:80:5
   |
LL |     assert_ne!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert_ne!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:151:5
   |
LL |     usr_println!(true, "error: {}", format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:154:5
   |
LL |     usr_println!(true, "{}: {}", error, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:157:5
   |
LL |     usr_println!(true, "{:?}: {}", error, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:160:5
   |
LL |     usr_println!(true, "{{}}: {}", format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:163:5
   |
LL |     usr_println!(true, r#"error: "{}""#, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:166:5
   |
LL |     usr_println!(true, "error: {}", format!(r#"boom at "{}""#, Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:169:5
   |
LL |     usr_println!(true, "error: {}", format!("boom at {} {0}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: aborting due to 24 previous errors



---

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:29:5
   |
LL |     println!("{}: {}", error, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:32:5
   |
LL |     println!("{:?}: {}", error, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:35:5
   |
LL |     println!("{{}}: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:38:5
   |
LL |     println!(r#"error: "{}""#, format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:41:5
   |
LL |     println!("error: {}", format!(r#"something failed at "{}""#, Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:44:5
   |
LL |     println!("error: {}", format!("something failed at {} {0}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `println!(..)` call
   = help: or consider changing `format!` to `format_args!`

---
LL | |         format!("something failed at {}", Location::caller())
LL | |     );
   | |_____^
   |
   = help: combine the `format!(..)` arguments with the outer `write!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `writeln!` args
##[error]  --> tests/ui/format_args_unfixable.rs:56:13
   |
LL |       let _ = writeln!(
---
LL | |         format!("something failed at {}", Location::caller())
LL | |     );
   | |_____^
   |
   = help: combine the `format!(..)` arguments with the outer `writeln!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `print!` args
##[error]  --> tests/ui/format_args_unfixable.rs:62:5
   |
LL |     print!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `print!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `eprint!` args
##[error]  --> tests/ui/format_args_unfixable.rs:65:5
   |
LL |     eprint!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `eprint!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `eprintln!` args
##[error]  --> tests/ui/format_args_unfixable.rs:68:5
   |
LL |     eprintln!("error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `eprintln!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `format_args!` args
##[error]  --> tests/ui/format_args_unfixable.rs:71:13
   |
LL |     let _ = format_args!("error: {}", format!("something failed at {}", Location::caller()));
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `format_args!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert!` args
##[error]  --> tests/ui/format_args_unfixable.rs:74:5
   |
LL |     assert!(true, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert_eq!` args
##[error]  --> tests/ui/format_args_unfixable.rs:77:5
   |
LL |     assert_eq!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert_eq!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `assert_ne!` args
##[error]  --> tests/ui/format_args_unfixable.rs:80:5
   |
LL |     assert_ne!(0, 0, "error: {}", format!("something failed at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `assert_ne!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:151:5
   |
LL |     usr_println!(true, "error: {}", format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:154:5
   |
LL |     usr_println!(true, "{}: {}", error, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:157:5
   |
LL |     usr_println!(true, "{:?}: {}", error, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:160:5
   |
LL |     usr_println!(true, "{{}}: {}", format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:163:5
   |
LL |     usr_println!(true, r#"error: "{}""#, format!("boom at {}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:166:5
   |
LL |     usr_println!(true, "error: {}", format!(r#"boom at "{}""#, Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: `format!` in `usr_println!` args
##[error]  --> tests/ui/format_args_unfixable.rs:169:5
   |
LL |     usr_println!(true, "error: {}", format!("boom at {} {0}", Location::caller()));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: combine the `format!(..)` arguments with the outer `usr_println!(..)` call
   = help: or consider changing `format!` to `format_args!`

error: aborting due to 24 previous errors


full stdout:



FAILED TEST: tests/ui/format_args.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-d66901fcf071c39e.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-299b005361846292.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c9d012fa1351c9a1.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-6ae23cd7ef138de2.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d494e6b7c1a6e89b.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-d4e4179d28fd4b4c.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-95eabeacab2cfa43.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-1717c86f14e427fe.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-75c78277780d7d9c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-37f19c6bbbc5eedb.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-b4ef3187156cf2a5.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0086164b4f00891f.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-ab47290081742c1b.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/format_args.rs" "--edition" "2021"

error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/format_args.stderr` to the actual output
--- tests/ui/format_args.stderr
+++ <stderr output>
---
-
 error: `to_string` applied to a type that implements `Display` in `println!` args
   --> tests/ui/format_args.rs:109:20
... 80 lines skipped ...
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]`
 
-error: aborting due to 26 previous errors
+error: aborting due to 25 previous errors
 

---
   |
LL |     println!("error: something failed at {}", Location::caller().to_string());
   |                                                                 ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `eprint!` args
##[error]  --> tests/ui/format_args.rs:95:64
   |
LL |     eprint!("error: something failed at {}", Location::caller().to_string());
   |                                                                ^^^^^^^^^^^^ help: remove this

---

error: `to_string` applied to a type that implements `Display` in `assert!` args
##[error]  --> tests/ui/format_args.rs:101:70
   |
LL |     assert!(true, "error: something failed at {}", Location::caller().to_string());
   |                                                                      ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `assert_eq!` args
##[error]  --> tests/ui/format_args.rs:103:73
   |
LL |     assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string());
   |                                                                         ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `assert_ne!` args
##[error]  --> tests/ui/format_args.rs:105:73
   |
LL |     assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string());
   |                                                                         ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:109:20
   |
LL |     println!("{}", X(1).to_string());
   |                    ^^^^^^^^^^^^^^^^ help: use this: `*X(1)`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:111:20
   |
LL |     println!("{}", Y(&X(1)).to_string());
   |                    ^^^^^^^^^^^^^^^^^^^^ help: use this: `***Y(&X(1))`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:113:24
   |
LL |     println!("{}", Z(1).to_string());
   |                        ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:115:20
   |
LL |     println!("{}", x.to_string());
   |                    ^^^^^^^^^^^^^ help: use this: `**x`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:117:20
   |
LL |     println!("{}", x_ref.to_string());
   |                    ^^^^^^^^^^^^^^^^^ help: use this: `***x_ref`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:120:39
   |
LL |     println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar");
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:122:52
   |
LL |     println!("{foo}{bar}", foo = "foo", bar = "bar".to_string());
   |                                                    ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:124:39
   |
LL |     println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo");
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:126:52
   |
LL |     println!("{foo}{bar}", bar = "bar", foo = "foo".to_string());
   |                                                    ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:128:37
   |
LL |     println!("{}", my_other_macro!().to_string());
   |                                     ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `print!` args
##[error]  --> tests/ui/format_args.rs:141:37
   |
LL |     print!("{}", (Location::caller().to_string()));
   |                                     ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `print!` args
##[error]  --> tests/ui/format_args.rs:143:39
   |
LL |     print!("{}", ((Location::caller()).to_string()));
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `format!` args
##[error]  --> tests/ui/format_args.rs:172:38
   |
LL |         let x = format!("{} {}", a, b.to_string());
   |                                      ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:187:24
   |
LL |         println!("{}", original[..10].to_string());
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]`

error: aborting due to 25 previous errors



---
   |
LL |     println!("error: something failed at {}", Location::caller().to_string());
   |                                                                 ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `eprint!` args
##[error]  --> tests/ui/format_args.rs:95:64
   |
LL |     eprint!("error: something failed at {}", Location::caller().to_string());
   |                                                                ^^^^^^^^^^^^ help: remove this

---

error: `to_string` applied to a type that implements `Display` in `assert!` args
##[error]  --> tests/ui/format_args.rs:101:70
   |
LL |     assert!(true, "error: something failed at {}", Location::caller().to_string());
   |                                                                      ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `assert_eq!` args
##[error]  --> tests/ui/format_args.rs:103:73
   |
LL |     assert_eq!(0, 0, "error: something failed at {}", Location::caller().to_string());
   |                                                                         ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `assert_ne!` args
##[error]  --> tests/ui/format_args.rs:105:73
   |
LL |     assert_ne!(0, 0, "error: something failed at {}", Location::caller().to_string());
   |                                                                         ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:109:20
   |
LL |     println!("{}", X(1).to_string());
   |                    ^^^^^^^^^^^^^^^^ help: use this: `*X(1)`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:111:20
   |
LL |     println!("{}", Y(&X(1)).to_string());
   |                    ^^^^^^^^^^^^^^^^^^^^ help: use this: `***Y(&X(1))`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:113:24
   |
LL |     println!("{}", Z(1).to_string());
   |                        ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:115:20
   |
LL |     println!("{}", x.to_string());
   |                    ^^^^^^^^^^^^^ help: use this: `**x`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:117:20
   |
LL |     println!("{}", x_ref.to_string());
   |                    ^^^^^^^^^^^^^^^^^ help: use this: `***x_ref`

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:120:39
   |
LL |     println!("{foo}{bar}", foo = "foo".to_string(), bar = "bar");
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:122:52
   |
LL |     println!("{foo}{bar}", foo = "foo", bar = "bar".to_string());
   |                                                    ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:124:39
   |
LL |     println!("{foo}{bar}", bar = "bar".to_string(), foo = "foo");
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:126:52
   |
LL |     println!("{foo}{bar}", bar = "bar", foo = "foo".to_string());
   |                                                    ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:128:37
   |
LL |     println!("{}", my_other_macro!().to_string());
   |                                     ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `print!` args
##[error]  --> tests/ui/format_args.rs:141:37
   |
LL |     print!("{}", (Location::caller().to_string()));
   |                                     ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `print!` args
##[error]  --> tests/ui/format_args.rs:143:39
   |
LL |     print!("{}", ((Location::caller()).to_string()));
   |                                       ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `format!` args
##[error]  --> tests/ui/format_args.rs:172:38
   |
LL |         let x = format!("{} {}", a, b.to_string());
   |                                      ^^^^^^^^^^^^ help: remove this

error: `to_string` applied to a type that implements `Display` in `println!` args
##[error]  --> tests/ui/format_args.rs:187:24
   |
LL |         println!("{}", original[..10].to_string());
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use this: `&original[..10]`

error: aborting due to 25 previous errors


full stdout:



FAILED TEST: tests/ui/uninlined_format_args_panic.rs (revision `edition2021`)
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-d66901fcf071c39e.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-299b005361846292.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c9d012fa1351c9a1.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-6ae23cd7ef138de2.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d494e6b7c1a6e89b.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-d4e4179d28fd4b4c.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-95eabeacab2cfa43.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-1717c86f14e427fe.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-75c78277780d7d9c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-37f19c6bbbc5eedb.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-b4ef3187156cf2a5.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0086164b4f00891f.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-ab47290081742c1b.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/uninlined_format_args_panic.rs" "--edition" "2021" "--cfg=edition2021" "-Cextra-filename=edition2021"

error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/uninlined_format_args_panic.edition2021.stderr` to the actual output
--- tests/ui/uninlined_format_args_panic.edition2021.stderr
+++ <stderr output>
 error: variables can be used directly in the `format!` string
   --> tests/ui/uninlined_format_args_panic.rs:11:5
... 11 lines skipped ...
 
 error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args_panic.rs:15:9
-   |
-LL |         panic!("p1 {}", var);
-   |         ^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p1 {}", var);
-LL +         panic!("p1 {var}");
-   |
-
-error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args_panic.rs:19:9
-   |
-LL |         panic!("p2 {0}", var);
-   |         ^^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p2 {0}", var);
-LL +         panic!("p2 {var}");
-   |
-
-error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args_panic.rs:23:9
-   |
-LL |         panic!("p3 {var}", var = var);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p3 {var}", var = var);
-LL +         panic!("p3 {var}");
-   |
-
-error: variables can be used directly in the `format!` string
   --> tests/ui/uninlined_format_args_panic.rs:34:5
    |
---
Full unnormalized output:
error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:11:5
   |
LL |     println!("val='{}'", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
   |
LL -     println!("val='{}'", var);
LL +     println!("val='{var}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:34:5
   |
LL |     assert!(var == 1, "p5 {}", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     assert!(var == 1, "p5 {}", var);
LL +     assert!(var == 1, "p5 {var}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:36:5
   |
LL |     debug_assert!(var == 1, "p6 {}", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     debug_assert!(var == 1, "p6 {}", var);
LL +     debug_assert!(var == 1, "p6 {var}");
   |

error: aborting due to 3 previous errors



error: diagnostic code `clippy::uninlined_format_args` not found on line 15
##[error]  --> tests/ui/uninlined_format_args_panic.rs:16:27
   |
16 |         //~[edition2021]^ uninlined_format_args
   |                           ^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
   |

error: diagnostic code `clippy::uninlined_format_args` not found on line 19
##[error]  --> tests/ui/uninlined_format_args_panic.rs:20:27
   |
20 |         //~[edition2021]^ uninlined_format_args
   |                           ^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
   |

error: diagnostic code `clippy::uninlined_format_args` not found on line 23
##[error]  --> tests/ui/uninlined_format_args_panic.rs:24:27
   |
24 |         //~[edition2021]^ uninlined_format_args
   |                           ^^^^^^^^^^^^^^^^^^^^^ expected because of this pattern
   |

full stderr:
error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:11:5
   |
LL |     println!("val='{}'", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
   |
LL -     println!("val='{}'", var);
LL +     println!("val='{var}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:34:5
   |
LL |     assert!(var == 1, "p5 {}", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     assert!(var == 1, "p5 {}", var);
LL +     assert!(var == 1, "p5 {var}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args_panic.rs:36:5
   |
LL |     debug_assert!(var == 1, "p6 {}", var);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     debug_assert!(var == 1, "p6 {}", var);
LL +     debug_assert!(var == 1, "p6 {var}");
   |

error: aborting due to 3 previous errors


full stdout:



FAILED TEST: tests/ui/uninlined_format_args.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps" "--extern=clippy_config=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_config-d66901fcf071c39e.rlib" "--extern=clippy_lints=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_lints-299b005361846292.rlib" "--extern=clippy_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libclippy_utils-c9d012fa1351c9a1.rlib" "--extern=futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libfutures-6ae23cd7ef138de2.rlib" "--extern=if_chain=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libif_chain-d494e6b7c1a6e89b.rlib" "--extern=itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libitertools-d4e4179d28fd4b4c.rlib" "--extern=parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libparking_lot-95eabeacab2cfa43.rlib" "--extern=quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libquote-1717c86f14e427fe.rlib" "--extern=regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libregex-75c78277780d7d9c.rlib" "--extern=serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libserde-37f19c6bbbc5eedb.rlib" "--extern=serde_derive=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde_derive-b4ef3187156cf2a5.so" "--extern=syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libsyn-0086164b4f00891f.rlib" "--extern=tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/libtokio-ab47290081742c1b.rlib" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/release/deps" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui" "tests/ui/uninlined_format_args.rs" "--extern" "proc_macros=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui/auxiliary/libproc_macros.so" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/ui_test/0/tests/ui/auxiliary" "--edition" "2021"

error: actual output differed from expected
Execute `cargo uibless` to update `tests/ui/uninlined_format_args.stderr` to the actual output
--- tests/ui/uninlined_format_args.stderr
+++ <stderr output>
 error: variables can be used directly in the `format!` string
   --> tests/ui/uninlined_format_args.rs:45:5
... 798 lines skipped ...
 
 error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args.rs:230:9
-   |
-LL |         panic!("p1 {}", local_i32);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p1 {}", local_i32);
-LL +         panic!("p1 {local_i32}");
-   |
-
-error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args.rs:234:9
-   |
-LL |         panic!("p2 {0}", local_i32);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p2 {0}", local_i32);
-LL +         panic!("p2 {local_i32}");
-   |
-
-error: variables can be used directly in the `format!` string
-  --> tests/ui/uninlined_format_args.rs:238:9
-   |
-LL |         panic!("p3 {local_i32}", local_i32 = local_i32);
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-help: change this to
-   |
-LL -         panic!("p3 {local_i32}", local_i32 = local_i32);
-LL +         panic!("p3 {local_i32}");
-   |
-
-error: variables can be used directly in the `format!` string
   --> tests/ui/uninlined_format_args.rs:259:5
    |
---
Full unnormalized output:
error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:45:5
   |
LL |     println!("val='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
   |
LL -     println!("val='{}'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:47:5
   |
LL |     println!("val='{   }'", local_i32); // 3 spaces
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{   }'", local_i32); // 3 spaces
LL +     println!("val='{local_i32}'"); // 3 spaces
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:50:5
   |
LL |     println!("val='{    }'", local_i32); // tab
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{    }'", local_i32); // tab
LL +     println!("val='{local_i32}'"); // tab
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:53:5
   |
LL |     println!("val='{     }'", local_i32); // space+tab
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{     }'", local_i32); // space+tab
LL +     println!("val='{local_i32}'"); // space+tab
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:56:5
   |
LL |     println!("val='{     }'", local_i32); // tab+space
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{     }'", local_i32); // tab+space
LL +     println!("val='{local_i32}'"); // tab+space
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:59:5
   |
---
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:67:5
   |
LL |     println!("{}", fn_arg);
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", fn_arg);
LL +     println!("{fn_arg}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:69:5
   |
LL |     println!("{:?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:?}", local_i32);
LL +     println!("{local_i32:?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:71:5
   |
LL |     println!("{:#?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:#?}", local_i32);
LL +     println!("{local_i32:#?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:73:5
   |
LL |     println!("{:4}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:4}", local_i32);
LL +     println!("{local_i32:4}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:75:5
   |
LL |     println!("{:04}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:04}", local_i32);
LL +     println!("{local_i32:04}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:77:5
   |
LL |     println!("{:<3}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:<3}", local_i32);
LL +     println!("{local_i32:<3}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:79:5
   |
LL |     println!("{:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:#010x}", local_i32);
LL +     println!("{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:81:5
   |
LL |     println!("{:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:.1}", local_f64);
LL +     println!("{local_f64:.1}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:86:5
   |
LL |     println!("{} {}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{} {}", local_i32, local_f64);
LL +     println!("{local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:89:5
   |
LL |     println!("{}", val);
   |     ^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:91:5
   |
LL |     println!("{}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", v = val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:94:5
   |
LL |     println!("val='{\t }'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{\t }'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:96:5
   |
LL |     println!("val='{\n }'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{\n }'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:98:5
   |
LL |     println!("val='{local_i32}'", local_i32 = local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{local_i32}'", local_i32 = local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:100:5
   |
LL |     println!("val='{local_i32}'", local_i32 = fn_arg);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{local_i32}'", local_i32 = fn_arg);
LL +     println!("val='{fn_arg}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:102:5
   |
LL |     println!("{0}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0}", local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:104:5
   |
LL |     println!("{0:?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:?}", local_i32);
LL +     println!("{local_i32:?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:106:5
   |
LL |     println!("{0:#?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:#?}", local_i32);
LL +     println!("{local_i32:#?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:108:5
   |
LL |     println!("{0:04}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:04}", local_i32);
LL +     println!("{local_i32:04}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:110:5
   |
LL |     println!("{0:<3}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:<3}", local_i32);
LL +     println!("{local_i32:<3}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:112:5
   |
LL |     println!("{0:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:#010x}", local_i32);
LL +     println!("{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:114:5
   |
LL |     println!("{0:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:.1}", local_f64);
LL +     println!("{local_f64:.1}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:116:5
   |
LL |     println!("{0} {0}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0} {0}", local_i32);
LL +     println!("{local_i32} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:118:5
   |
LL |     println!("{1} {} {0} {}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {} {0} {}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32} {local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:120:5
   |
LL |     println!("{0} {1}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0} {1}", local_i32, local_f64);
LL +     println!("{local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:122:5
   |
LL |     println!("{1} {0}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {0}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:124:5
   |
LL |     println!("{1} {0} {1} {0}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {0} {1} {0}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32} {local_f64} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:127:5
   |
LL |     println!("{v}", v = local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v}", v = local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:129:5
   |
LL |     println!("{local_i32:0$}", width);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:0$}", width);
LL +     println!("{local_i32:width$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:131:5
   |
LL |     println!("{local_i32:w$}", w = width);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:w$}", w = width);
LL +     println!("{local_i32:width$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:133:5
   |
LL |     println!("{local_i32:.0$}", prec);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:.0$}", prec);
LL +     println!("{local_i32:.prec$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:135:5
   |
LL |     println!("{local_i32:.p$}", p = prec);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:.p$}", p = prec);
LL +     println!("{local_i32:.prec$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:137:5
   |
LL |     println!("{:0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:0$}", v = val);
LL +     println!("{val:val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:139:5
   |
LL |     println!("{0:0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$}", v = val);
LL +     println!("{val:val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:141:5
   |
LL |     println!("{:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:143:5
   |
LL |     println!("{0:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:145:5
   |
LL |     println!("{0:0$.v$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$.v$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:147:5
   |
LL |     println!("{0:v$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:v$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:149:5
   |
LL |     println!("{v:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:151:5
   |
LL |     println!("{v:v$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:v$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:153:5
   |
LL |     println!("{v:0$.v$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:0$.v$}", v = val);
LL +     println!("{val:val$.val$}");
   |

---

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:223:5
   |
LL |     println!("{}", /* comment with a comma , in it */ val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", /* comment with a comma , in it */ val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:259:5
   |
LL |     println!("expand='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("expand='{}'", local_i32);
LL +     println!("expand='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:362:5
   |
LL |     usr_println!(true, "val='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "val='{}'", local_i32);
LL +     usr_println!(true, "val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:364:5
   |
LL |     usr_println!(true, "{}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{}", local_i32);
LL +     usr_println!(true, "{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:366:5
   |
LL |     usr_println!(true, "{:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{:#010x}", local_i32);
LL +     usr_println!(true, "{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:368:5
   |
LL |     usr_println!(true, "{:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{:.1}", local_f64);
LL +     usr_println!(true, "{local_f64:.1}");
   |

error: aborting due to 72 previous errors


---
full stderr:
error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:45:5
   |
LL |     println!("val='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::uninlined-format-args` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
   |
LL -     println!("val='{}'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:47:5
   |
LL |     println!("val='{   }'", local_i32); // 3 spaces
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{   }'", local_i32); // 3 spaces
LL +     println!("val='{local_i32}'"); // 3 spaces
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:50:5
   |
LL |     println!("val='{    }'", local_i32); // tab
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{    }'", local_i32); // tab
LL +     println!("val='{local_i32}'"); // tab
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:53:5
   |
LL |     println!("val='{     }'", local_i32); // space+tab
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{     }'", local_i32); // space+tab
LL +     println!("val='{local_i32}'"); // space+tab
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:56:5
   |
LL |     println!("val='{     }'", local_i32); // tab+space
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{     }'", local_i32); // tab+space
LL +     println!("val='{local_i32}'"); // tab+space
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:59:5
   |
---
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:67:5
   |
LL |     println!("{}", fn_arg);
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", fn_arg);
LL +     println!("{fn_arg}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:69:5
   |
LL |     println!("{:?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:?}", local_i32);
LL +     println!("{local_i32:?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:71:5
   |
LL |     println!("{:#?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:#?}", local_i32);
LL +     println!("{local_i32:#?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:73:5
   |
LL |     println!("{:4}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:4}", local_i32);
LL +     println!("{local_i32:4}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:75:5
   |
LL |     println!("{:04}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:04}", local_i32);
LL +     println!("{local_i32:04}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:77:5
   |
LL |     println!("{:<3}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:<3}", local_i32);
LL +     println!("{local_i32:<3}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:79:5
   |
LL |     println!("{:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:#010x}", local_i32);
LL +     println!("{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:81:5
   |
LL |     println!("{:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:.1}", local_f64);
LL +     println!("{local_f64:.1}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:86:5
   |
LL |     println!("{} {}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{} {}", local_i32, local_f64);
LL +     println!("{local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:89:5
   |
LL |     println!("{}", val);
   |     ^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:91:5
   |
LL |     println!("{}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", v = val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:94:5
   |
LL |     println!("val='{\t }'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{\t }'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:96:5
   |
LL |     println!("val='{\n }'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{\n }'", local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:98:5
   |
LL |     println!("val='{local_i32}'", local_i32 = local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{local_i32}'", local_i32 = local_i32);
LL +     println!("val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:100:5
   |
LL |     println!("val='{local_i32}'", local_i32 = fn_arg);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("val='{local_i32}'", local_i32 = fn_arg);
LL +     println!("val='{fn_arg}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:102:5
   |
LL |     println!("{0}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0}", local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:104:5
   |
LL |     println!("{0:?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:?}", local_i32);
LL +     println!("{local_i32:?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:106:5
   |
LL |     println!("{0:#?}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:#?}", local_i32);
LL +     println!("{local_i32:#?}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:108:5
   |
LL |     println!("{0:04}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:04}", local_i32);
LL +     println!("{local_i32:04}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:110:5
   |
LL |     println!("{0:<3}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:<3}", local_i32);
LL +     println!("{local_i32:<3}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:112:5
   |
LL |     println!("{0:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:#010x}", local_i32);
LL +     println!("{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:114:5
   |
LL |     println!("{0:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:.1}", local_f64);
LL +     println!("{local_f64:.1}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:116:5
   |
LL |     println!("{0} {0}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0} {0}", local_i32);
LL +     println!("{local_i32} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:118:5
   |
LL |     println!("{1} {} {0} {}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {} {0} {}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32} {local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:120:5
   |
LL |     println!("{0} {1}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0} {1}", local_i32, local_f64);
LL +     println!("{local_i32} {local_f64}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:122:5
   |
LL |     println!("{1} {0}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {0}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:124:5
   |
LL |     println!("{1} {0} {1} {0}", local_i32, local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{1} {0} {1} {0}", local_i32, local_f64);
LL +     println!("{local_f64} {local_i32} {local_f64} {local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:127:5
   |
LL |     println!("{v}", v = local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v}", v = local_i32);
LL +     println!("{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:129:5
   |
LL |     println!("{local_i32:0$}", width);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:0$}", width);
LL +     println!("{local_i32:width$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:131:5
   |
LL |     println!("{local_i32:w$}", w = width);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:w$}", w = width);
LL +     println!("{local_i32:width$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:133:5
   |
LL |     println!("{local_i32:.0$}", prec);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:.0$}", prec);
LL +     println!("{local_i32:.prec$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:135:5
   |
LL |     println!("{local_i32:.p$}", p = prec);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{local_i32:.p$}", p = prec);
LL +     println!("{local_i32:.prec$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:137:5
   |
LL |     println!("{:0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:0$}", v = val);
LL +     println!("{val:val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:139:5
   |
LL |     println!("{0:0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$}", v = val);
LL +     println!("{val:val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:141:5
   |
LL |     println!("{:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:143:5
   |
LL |     println!("{0:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:145:5
   |
LL |     println!("{0:0$.v$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:0$.v$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:147:5
   |
LL |     println!("{0:v$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{0:v$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:149:5
   |
LL |     println!("{v:0$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:0$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:151:5
   |
LL |     println!("{v:v$.0$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:v$.0$}", v = val);
LL +     println!("{val:val$.val$}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:153:5
   |
LL |     println!("{v:0$.v$}", v = val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{v:0$.v$}", v = val);
LL +     println!("{val:val$.val$}");
   |

---

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:223:5
   |
LL |     println!("{}", /* comment with a comma , in it */ val);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("{}", /* comment with a comma , in it */ val);
LL +     println!("{val}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:259:5
   |
LL |     println!("expand='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     println!("expand='{}'", local_i32);
LL +     println!("expand='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:362:5
   |
LL |     usr_println!(true, "val='{}'", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "val='{}'", local_i32);
LL +     usr_println!(true, "val='{local_i32}'");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:364:5
   |
LL |     usr_println!(true, "{}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{}", local_i32);
LL +     usr_println!(true, "{local_i32}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:366:5
   |
LL |     usr_println!(true, "{:#010x}", local_i32);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{:#010x}", local_i32);
LL +     usr_println!(true, "{local_i32:#010x}");
   |

error: variables can be used directly in the `format!` string
##[error]  --> tests/ui/uninlined_format_args.rs:368:5
   |
LL |     usr_println!(true, "{:.1}", local_f64);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: change this to
   |
LL -     usr_println!(true, "{:.1}", local_f64);
LL +     usr_println!(true, "{local_f64:.1}");
   |

error: aborting due to 72 previous errors


@Voultapher
Copy link
Contributor Author

@Amanieu this program previously worked:

use std::*;

fn main() {
    panic!("panic works")
}

and now runs into:

error[E0659]: `panic` is ambiguous
   --> src/main.rs:4:5
    |
4   |     panic!("panic works")
    |     ^^^^^ ambiguous name
    |
    = note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
note: `panic` could refer to the macro imported here
   --> src/main.rs:1:5
    |
1   | use std::*;
    |     ^^^^^^
    = help: consider adding an explicit import of `panic` to disambiguate
    = help: or use `crate::panic` to refer to this macro unambiguously
note: `panic` could also refer to the macro defined here
   --> rust/library/std/src/prelude/mod.rs:157:13
    |
157 |     pub use super::v1::*;
    |             ^^^^^^^^^

I don't see how we can resolve that without changing language import rules and or special casing the prelude import.

@Amanieu
Copy link
Member

Amanieu commented Apr 9, 2025

@petrochenkov Do you have any ideas about that?

@petrochenkov petrochenkov self-assigned this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants