Open dtolnay opened 9 months ago
Amusingly, this is the reverse of https://github.com/rust-lang/rustfmt/issues/5309, where a blank line is preserved between outer attributes and the item. For outer attrs the blank line should not be preserved. For inner attrs (this issue), I want it to be preserved.
This is where we're rewriting the inner attributes: https://github.com/rust-lang/rustfmt/blob/85e21fabf437a2a9cbee73136a895f4440120b19/src/matches.rs#L101-L109
@rustbot claim
Example real-world code, which I have manually formatted exactly as I would want; this is the input and desired output:
But, rustfmt applies the following diff, which is undesirable.
Rustfmt's formatting makes it look as though the inner attr is an outer attr on the first arm.
Module-level inner attrs, like the
#![feature(...)]
above, are not affected. If rustfmt were removing blank line between module-level inner attrs and the first item, I think it's obvious that would be considered undesirable: