File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1343,6 +1343,7 @@ pub fn can_be_overflowed_expr(
1343
1343
args_len : usize ,
1344
1344
) -> bool {
1345
1345
match expr. node {
1346
+ _ if !expr. attrs . is_empty ( ) => false ,
1346
1347
ast:: ExprKind :: Match ( ..) => {
1347
1348
( context. use_block_indent ( ) && args_len == 1 )
1348
1349
|| ( context. config . indent_style ( ) == IndentStyle :: Visual && args_len > 1 )
Original file line number Diff line number Diff line change @@ -91,6 +91,17 @@ impl<'a> Spanned for OverflowableItem<'a> {
91
91
}
92
92
93
93
impl < ' a > OverflowableItem < ' a > {
94
+ fn has_attrs ( & self ) -> bool {
95
+ match self {
96
+ OverflowableItem :: Expr ( ast:: Expr { attrs, .. } )
97
+ | OverflowableItem :: GenericParam ( ast:: GenericParam { attrs, .. } ) => !attrs. is_empty ( ) ,
98
+ OverflowableItem :: StructField ( ast:: StructField { attrs, .. } ) => !attrs. is_empty ( ) ,
99
+ OverflowableItem :: MacroArg ( MacroArg :: Expr ( expr) ) => !expr. attrs . is_empty ( ) ,
100
+ OverflowableItem :: MacroArg ( MacroArg :: Item ( item) ) => !item. attrs . is_empty ( ) ,
101
+ _ => false ,
102
+ }
103
+ }
104
+
94
105
pub fn map < F , T > ( & self , f : F ) -> T
95
106
where
96
107
F : Fn ( & dyn IntoOverflowableItem < ' a > ) -> T ,
@@ -447,6 +458,7 @@ impl<'a> Context<'a> {
447
458
// 1 = "("
448
459
let combine_arg_with_callee = self . items . len ( ) == 1
449
460
&& self . items [ 0 ] . is_expr ( )
461
+ && !self . items [ 0 ] . has_attrs ( )
450
462
&& self . ident . len ( ) < self . context . config . tab_spaces ( ) ;
451
463
let overflow_last = combine_arg_with_callee || can_be_overflowed ( self . context , & self . items ) ;
452
464
You can’t perform that action at this time.
0 commit comments