@@ -1814,6 +1814,10 @@ where
1814
1814
let used_width = extra_offset ( callee_str, shape) ;
1815
1815
let one_line_width = shape. width . checked_sub ( used_width + 2 * paren_overhead) ?;
1816
1816
1817
+ // 1 = "(" or ")"
1818
+ let one_line_shape = shape
1819
+ . offset_left ( last_line_width ( callee_str) + 1 ) ?
1820
+ . sub_width ( 1 ) ?;
1817
1821
let nested_shape = shape_from_indent_style (
1818
1822
context,
1819
1823
shape,
@@ -1828,6 +1832,7 @@ where
1828
1832
context,
1829
1833
args,
1830
1834
args_span,
1835
+ one_line_shape,
1831
1836
nested_shape,
1832
1837
one_line_width,
1833
1838
args_max_width,
@@ -1867,7 +1872,8 @@ fn rewrite_call_args<'a, T>(
1867
1872
context : & RewriteContext ,
1868
1873
args : & [ & T ] ,
1869
1874
span : Span ,
1870
- shape : Shape ,
1875
+ one_line_shape : Shape ,
1876
+ nested_shape : Shape ,
1871
1877
one_line_width : usize ,
1872
1878
args_max_width : usize ,
1873
1879
force_trailing_comma : bool ,
@@ -1882,7 +1888,7 @@ where
1882
1888
"," ,
1883
1889
|item| item. span ( ) . lo ( ) ,
1884
1890
|item| item. span ( ) . hi ( ) ,
1885
- |item| item. rewrite ( context, shape ) ,
1891
+ |item| item. rewrite ( context, nested_shape ) ,
1886
1892
span. lo ( ) ,
1887
1893
span. hi ( ) ,
1888
1894
true ,
@@ -1896,7 +1902,8 @@ where
1896
1902
context,
1897
1903
& mut item_vec,
1898
1904
& args[ ..] ,
1899
- shape,
1905
+ one_line_shape,
1906
+ nested_shape,
1900
1907
one_line_width,
1901
1908
args_max_width,
1902
1909
) ;
@@ -1912,7 +1919,7 @@ where
1912
1919
context. config . trailing_comma ( )
1913
1920
} ,
1914
1921
separator_place : SeparatorPlace :: Back ,
1915
- shape : shape ,
1922
+ shape : nested_shape ,
1916
1923
ends_with_newline : context. use_block_indent ( ) && tactic == DefinitiveListTactic :: Vertical ,
1917
1924
preserve_newline : false ,
1918
1925
config : context. config ,
@@ -1927,7 +1934,8 @@ fn try_overflow_last_arg<'a, T>(
1927
1934
context : & RewriteContext ,
1928
1935
item_vec : & mut Vec < ListItem > ,
1929
1936
args : & [ & T ] ,
1930
- shape : Shape ,
1937
+ one_line_shape : Shape ,
1938
+ nested_shape : Shape ,
1931
1939
one_line_width : usize ,
1932
1940
args_max_width : usize ,
1933
1941
) -> DefinitiveListTactic
@@ -1945,7 +1953,7 @@ where
1945
1953
context. force_one_line_chain = true ;
1946
1954
}
1947
1955
}
1948
- last_arg_shape ( & context, item_vec, shape , args_max_width) . and_then ( |arg_shape| {
1956
+ last_arg_shape ( & context, item_vec, one_line_shape , args_max_width) . and_then ( |arg_shape| {
1949
1957
rewrite_last_arg_with_overflow ( & context, args, & mut item_vec[ args. len ( ) - 1 ] , arg_shape)
1950
1958
} )
1951
1959
} else {
0 commit comments