You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 variable name: Ident produces an Ident with Span::call_site(), whereas format_ident!("{}", name) produces an Ident that keeps the span of name.
The text was updated successfully, but these errors were encountered:
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.
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
.The text was updated successfully, but these errors were encountered: