@@ -136,11 +136,12 @@ impl<'a> FmtVisitor<'a> {
136
136
debug ! ( "rewrite_fn: one_line_budget: {}, multi_line_budget: {}, arg_indent: {}" ,
137
137
one_line_budget, multi_line_budget, arg_indent) ;
138
138
139
+ // Check if vertical layout was forced by compute_budget_for_args.
139
140
if one_line_budget <= 0 {
140
141
if config ! ( fn_args_paren_newline) {
141
142
result. push ( '\n' ) ;
142
143
result. push_str ( & make_indent ( arg_indent) ) ;
143
- arg_indent = arg_indent + 1 ;
144
+ arg_indent = arg_indent + 1 ; // extra space for `(`
144
145
result. push ( '(' ) ;
145
146
} else {
146
147
result. push_str ( "(\n " ) ;
@@ -378,15 +379,14 @@ impl<'a> FmtVisitor<'a> {
378
379
379
380
// Didn't work. we must force vertical layout and put args on a newline.
380
381
if let None = budgets {
381
- // 6 = new indent + `()`
382
- let used_space = indent + 6 ;
382
+ let new_indent = indent + 4 ;
383
+ let used_space = new_indent + 2 ; // account for `(` and `)`
383
384
let max_space = config ! ( ideal_width) + config ! ( leeway) ;
384
385
if used_space > max_space {
385
386
// Whoops! bankrupt.
386
387
// TODO take evasive action, perhaps kill the indent or something.
387
388
} else {
388
- // 5 = new indent + `(`
389
- budgets = Some ( ( 0 , max_space - used_space, indent + 4 ) ) ;
389
+ budgets = Some ( ( 0 , max_space - used_space, new_indent) ) ;
390
390
}
391
391
}
392
392
0 commit comments