]> git.lizzy.rs Git - rust.git/commitdiff
Use vertical layout when args len is larger than fn_call_width
authortopecongiro <seuchida@gmail.com>
Fri, 12 May 2017 07:30:26 +0000 (16:30 +0900)
committertopecongiro <seuchida@gmail.com>
Fri, 12 May 2017 07:30:26 +0000 (16:30 +0900)
src/expr.rs
tests/source/configs-fn_call_width-zero.rs [new file with mode: 0644]
tests/target/configs-fn_call_style-block.rs
tests/target/configs-fn_call_width-zero.rs [new file with mode: 0644]

index da9a96bf19f303bae84a716c7f27458a03922493..4b34fd8bf6dbd2dffee5d7003839176ec0db5632 100644 (file)
@@ -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 (file)
index 0000000..ee79c4c
--- /dev/null
@@ -0,0 +1,7 @@
+// rustfmt-fn_call_width: 0
+// rustfmt-fn_call_style: block
+
+// #1508
+fn a() {
+    let x = f(y);
+}
index d7cb12dd94c87f79dd58b3bfe99e8127a213d709..c9a42cd49522d3ab001739b5500723f7e00e5bdf 100644 (file)
@@ -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 (file)
index 0000000..3193bc2
--- /dev/null
@@ -0,0 +1,9 @@
+// rustfmt-fn_call_width: 0
+// rustfmt-fn_call_style: block
+
+// #1508
+fn a() {
+    let x = f(
+        y,
+    );
+}