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
But instead, nothing happens. It doesn't only apply to format!. For normal functions it works but for macros it doesn't because the comma could potentially be important input for the macro and rustfmt doesn't know that in this case the comma doesn't have a meaning.
I think we should do something about that.
Maybe rustfmt can be made smarter to know that the comma is useless there?
Maybe only standard library macros can be put in a special "list" that rustfmt considers and then it removes trailing commas and other unnecessary stuff only from those macros. It might be unfair for macro authors that make macros outside the std.
Some kind of attribute could be added that can be applied to macros to say that this macro's parameters are to be handled similarly like a normal function? #[treat_parameters_as_function_parameters] or something like that.
Macros 2.0 are coming. Can they do something about this? Maybe we should make sure that with 2.0 macros it becomes easier to define macros where rustfmt can infer that trailing commas can be removed?
The text was updated successfully, but these errors were encountered:
Thanks for reaching out, but going to close this as a duplicate as it's been discussed in various other issues where I'd want to keep the discussion (refs #3277, #3065, #8)
If I format this, I expect to get this:
But instead, nothing happens. It doesn't only apply to
format!
. For normal functions it works but for macros it doesn't because the comma could potentially be important input for the macro and rustfmt doesn't know that in this case the comma doesn't have a meaning.I think we should do something about that.
std
.#[treat_parameters_as_function_parameters]
or something like that.The text was updated successfully, but these errors were encountered: