Result from format_args! cannot be center-aligned within another format string #46569
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
I can do
println!("{:=^80}", " TEST ")
to pretty-print a center-aligned header within equality signs.However, the alignment is ignored when I do
println!("{:=^80}", format_args!(" TEST "))
.I need the latter syntax to further write code like
println!("{:=^80}", format_args!(" TEST {:#016X} ", some_integer))
.I understand that a
format_args!
result is harder to center-align due to cases where the final width could be unknown. Nevertheless, it should be possible for the compiler to determine the string width in my example cases to let it be center-aligned.The text was updated successfully, but these errors were encountered: