@@ -818,11 +818,11 @@ E.g., `&&Some(foo)` matches, `Foo(4, Bar)` does not.
818818
819819## Combinable expressions  
820820
821- Where a function call has  a single argument, and that argument  is formatted
822- across  multiple-lines, format the outer call as if it were a single-line call,
821+ When the last argument in  a function call  is formatted across 
822+ multiple-lines, format the outer call as if it were a single-line call,
823823if the result fits. Apply the same combining behaviour to any similar
824824expressions which have multi-line, block-indented lists of sub-expressions
825- delimited by parentheses (e.g., macros  or tuple struct literals) . E.g.,
825+ delimited by parentheses, brackets,  or braces . E.g.,
826826
827827``` rust 
828828foo (bar (
@@ -848,20 +848,61 @@ let arr = [combinable(
848848    an_expr ,
849849    another_expr ,
850850)];
851+ 
852+ let  x  =  Thing (an_expr , another_expr , match  cond  {
853+     A  =>  1 ,
854+     B  =>  2 ,
855+ });
856+ 
857+ let  x  =  format! (" Stuff: {}" 
858+     an_expr ,
859+     another_expr ,
860+ ]);
861+ 
862+ let  x  =  func (an_expr , another_expr , SomeStruct  {
863+     field :  this_is_long ,
864+     another_field :  123 ,
865+ });
851866``` 
852867
853868Apply this behavior recursively.
854869
855- For a function with multiple arguments, if the last argument is a multi-line
856- closure with an explicit block, there are no other closure arguments, and all
857- the arguments and the first line of the closure fit on the first line, use the
858- same combining behavior:
870+ If the last argument is a multi-line closure with an explicit block,
871+ only apply the combining behavior if there are no other closure arguments.
859872
860873``` rust 
874+ //  Combinable
861875foo (first_arg , x , | param |  {
862876    action ();
863877    foo (param )
864878})
879+ //  Not combinable, because the closure is not the last argument
880+ foo (
881+     first_arg ,
882+     | param |  {
883+         action ();
884+         foo (param )
885+     },
886+     whatever ,
887+ )
888+ //  Not combinable, because the first line of the closure does not fit
889+ foo (
890+     first_arg ,
891+     x ,
892+     move  | very_long_param_causing_line_to_overflow |  ->  Bar  {
893+         action ();
894+         foo (param )
895+     },
896+ )
897+ //  Not combinable, because there is more than one closure argument
898+ foo (
899+     first_arg ,
900+     | x |  x . bar (),
901+     | param |  {
902+         action ();
903+         foo (param )
904+     },
905+ )
865906``` 
866907
867908## Ranges  
0 commit comments