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
Which is potentially surprising, since it's not immediately obvious that the _x in the println macro is acting like a named argument.
It would be useful to emit either a warning or an error so that named arguments that are used only based on position are identified to avoid causing confusion, since to a reader it looks like an assignment.
The text was updated successfully, but these errors were encountered:
Emit warning when named arguments are used positionally in format
Addresses Issue 98466 by emitting an error if a named argument
is used like a position argument (i.e. the name is not used in
the string to be formatted).
Fixesrust-lang#98466
Michale Gattozzi identified this on twitter with a compelling sample:
This prints
Which is potentially surprising, since it's not immediately obvious that the
_x
in theprintln
macro is acting like a named argument.It would be useful to emit either a warning or an error so that named arguments that are used only based on position are identified to avoid causing confusion, since to a reader it looks like an assignment.
The text was updated successfully, but these errors were encountered: