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
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:
#![feature(non_exhaustive_omitted_patterns_lint)]use syn::*;pubfnattrs_mut(e:&mutExpr) -> Option<&mutVec<Attribute>>{match e {...}}
The text was updated successfully, but these errors were encountered:
Amusingly, this is the reverse of #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.
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.
pub fn attrs_mut(e: &mut Expr) -> Option<&mut Vec<Attribute>> { match e { #![deny(non_exhaustive_omitted_patterns)] - Expr::Array(ExprArray { attrs, .. }) | Expr::Assign(ExprAssign { attrs, .. }) | Expr::Async(ExprAsync { attrs, .. })
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:The text was updated successfully, but these errors were encountered: