diff --git a/src/expr.rs b/src/expr.rs index da9a96bf19f..4b34fd8bf6d 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1784,7 +1784,8 @@ fn rewrite_call_args(context: &RewriteContext, // and not rewriting macro. Some(ref s) if context.config.fn_call_style == IndentStyle::Block && !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; write_list(&item_vec, &fmt) } diff --git a/tests/source/configs-fn_call_width-zero.rs b/tests/source/configs-fn_call_width-zero.rs new file mode 100644 index 00000000000..ee79c4ce805 --- /dev/null +++ b/tests/source/configs-fn_call_width-zero.rs @@ -0,0 +1,7 @@ +// rustfmt-fn_call_width: 0 +// rustfmt-fn_call_style: block + +// #1508 +fn a() { + let x = f(y); +} diff --git a/tests/target/configs-fn_call_style-block.rs b/tests/target/configs-fn_call_style-block.rs index d7cb12dd94c..c9a42cd4952 100644 --- a/tests/target/configs-fn_call_style-block.rs +++ b/tests/target/configs-fn_call_style-block.rs @@ -13,7 +13,9 @@ fn main() { "elit", ); // #1501 - let hyper = Arc::new(Client::with_connector(HttpsConnector::new(TlsClient::new()))); + let hyper = Arc::new( + Client::with_connector(HttpsConnector::new(TlsClient::new())), + ); } // #1521 diff --git a/tests/target/configs-fn_call_width-zero.rs b/tests/target/configs-fn_call_width-zero.rs new file mode 100644 index 00000000000..3193bc228f7 --- /dev/null +++ b/tests/target/configs-fn_call_width-zero.rs @@ -0,0 +1,9 @@ +// rustfmt-fn_call_width: 0 +// rustfmt-fn_call_style: block + +// #1508 +fn a() { + let x = f( + y, + ); +}