File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 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(
13431343 args_len : usize ,
13441344) -> bool {
13451345 match expr. node {
1346+ _ if !expr. attrs . is_empty ( ) => false ,
13461347 ast:: ExprKind :: Match ( ..) => {
13471348 ( context. use_block_indent ( ) && args_len == 1 )
13481349 || ( 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> {
9191}
9292
9393impl < ' 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+
94105 pub fn map < F , T > ( & self , f : F ) -> T
95106 where
96107 F : Fn ( & dyn IntoOverflowableItem < ' a > ) -> T ,
@@ -447,6 +458,7 @@ impl<'a> Context<'a> {
447458 // 1 = "("
448459 let combine_arg_with_callee = self . items . len ( ) == 1
449460 && self . items [ 0 ] . is_expr ( )
461+ && !self . items [ 0 ] . has_attrs ( )
450462 && self . ident . len ( ) < self . context . config . tab_spaces ( ) ;
451463 let overflow_last = combine_arg_with_callee || can_be_overflowed ( self . context , & self . items ) ;
452464
You can’t perform that action at this time.
0 commit comments