Use vertical layout when args len is larger than fn_call_width
This commit is contained in:
parent
88250c4af2
commit
384ce46eef
@ -1784,7 +1784,8 @@ fn rewrite_call_args(context: &RewriteContext,
|
|||||||
// and not rewriting macro.
|
// and not rewriting macro.
|
||||||
Some(ref s) if context.config.fn_call_style == IndentStyle::Block &&
|
Some(ref s) if context.config.fn_call_style == IndentStyle::Block &&
|
||||||
!force_no_trailing_comma &&
|
!force_no_trailing_comma &&
|
||||||
(!s.contains('\n') && s.len() > one_line_width) => {
|
(!s.contains('\n') &&
|
||||||
|
(s.len() > one_line_width || s.len() > context.config.fn_call_width)) => {
|
||||||
fmt.trailing_separator = SeparatorTactic::Vertical;
|
fmt.trailing_separator = SeparatorTactic::Vertical;
|
||||||
write_list(&item_vec, &fmt)
|
write_list(&item_vec, &fmt)
|
||||||
}
|
}
|
||||||
|
7
tests/source/configs-fn_call_width-zero.rs
Normal file
7
tests/source/configs-fn_call_width-zero.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// rustfmt-fn_call_width: 0
|
||||||
|
// rustfmt-fn_call_style: block
|
||||||
|
|
||||||
|
// #1508
|
||||||
|
fn a() {
|
||||||
|
let x = f(y);
|
||||||
|
}
|
@ -13,7 +13,9 @@ fn main() {
|
|||||||
"elit",
|
"elit",
|
||||||
);
|
);
|
||||||
// #1501
|
// #1501
|
||||||
let hyper = Arc::new(Client::with_connector(HttpsConnector::new(TlsClient::new())));
|
let hyper = Arc::new(
|
||||||
|
Client::with_connector(HttpsConnector::new(TlsClient::new())),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// #1521
|
// #1521
|
||||||
|
9
tests/target/configs-fn_call_width-zero.rs
Normal file
9
tests/target/configs-fn_call_width-zero.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// rustfmt-fn_call_width: 0
|
||||||
|
// rustfmt-fn_call_style: block
|
||||||
|
|
||||||
|
// #1508
|
||||||
|
fn a() {
|
||||||
|
let x = f(
|
||||||
|
y,
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user