-
Notifications
You must be signed in to change notification settings - Fork 900
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
Handle captured identifiers in format strings #5450
Comments
I wonder if rustfix might be a better venue for such transformations |
I just looked at rustfix readme: The magic of rustfix is entirely dependent on the diagnostics implemented in the Rust compiler (and external lints, like clippy). My understanding is that rustfix won't actually decide anything, but rather use whatever suggestion is made by rustc or clippy. I am not sure this type of fix would belong in the rustc itself. Do you think clippy would be a better target? |
I think clippy would probably be the best place to start, just to see if they happen to already have a lint or if they have one planned. If they do, then that's something rustfix could pick up. |
Thanks @calebcartwright , turns out clippy already has a similar (smaller-scoped) request, so closing in favor of rust-lang/rust-clippy#8368 |
Perfect, thanks for sharing! |
Since 1.58 Rust allows
println!("Hello, {person}!");
style strings (documentations). I would like to proposecargo fmt
to automatically convertprintln!("Hello, {}!", person);
and otherformat!
-like calls to the inlined versions, either by default, or, at least initially, as an opt-in.cargo fmt
println!("{}", a)
println!("{a}")
println!("{a}", a=b)
println!("{b}")
println!("{a:0$}", width)
println!("{a:width$}")
println!("{a:.0$}", prec)
println!("{a:.prec$}")
The text was updated successfully, but these errors were encountered: