Open msrd0 opened 2 years ago
This behavior really should be documented. As someone who started learning Rust at the beginning of 2023, I use the "{name}"
syntax for format strings by default and expected format_ident!
to work similar to every other format macro. I only figured out that the described behavior occurs when I was trying to use format_ident!
with a syn::Member
and the compiler was complaining that syn::Member
doesn't implement Display
.
Maybe related indirectly: format_ident!("{}", id)
would drop r#
, but format_ident!("{id}")
won't strip off r#
. Can this be remedied somehow?
format_ident!
seems to support the new capturing format strings introduced in Rust 1.58 on first glance. However,format_ident!("{name}")
with a captured variablename: Ident
produces anIdent
withSpan::call_site()
, whereasformat_ident!("{}", name)
produces anIdent
that keeps the span ofname
.