rustfmt
rustfmt copied to clipboard
[unstable option] format_macro_matchers
Tracking issue for unstable option: format_macro_matchers
There are a number of cases where format_macro_matchers adds spaces where Rust syntax would not normally have spaces. For instance:
- ($cg:ident.$field:ident) => {
+ ($cg:ident. $field:ident) => {
Rust code would normally have ident.ident with no spaces.
I think this option should determine whether to include spaces around a given token based on whether that token would normally have spaces in Rust code.
@joshtriplett @scampi I recently opened a PR to fix the opposite issue: #5573, where it was removing a space that should be there:
macro_rules! test_macro {
- ($child:expr, Module) => {
+ ($child:expr,Module) => {
let x = 11;
};
}
If everyone is in agreance that . shouldn't ever be followed by a space, I can take a pass at fixing it, while all the code is still fresh in my head! : v)
Personally, I don't think there's ever a reason for . to be followed by a space in 'normal' Rust, so I agree, seems like some dubious formatting to me...
@InsertCreativityHere I don't think there are any circumstances where . should have spaces around it, no. Thank you!