about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-09-02 09:41:08 +1200
committerNick Cameron <ncameron@mozilla.com>2015-09-02 09:41:08 +1200
commitfae93abbdaa9d2bcf7a3c2cff0c5c7beadc62cc7 (patch)
treed8d9ff511c50fddd1ca35d23faca0abc722913b5 /tests
parentf81485d9d6a93baf86affbcc60d0ea84bedc3556 (diff)
Support struct-like layouts for fn args
Diffstat (limited to 'tests')
-rw-r--r--tests/config/small_tabs.toml3
-rw-r--r--tests/source/fn-custom-6.rs36
-rw-r--r--tests/source/struct_lits_visual.rs2
-rw-r--r--tests/target/fn-custom-6.rs70
-rw-r--r--tests/target/struct_lits_visual.rs2
5 files changed, 110 insertions, 3 deletions
diff --git a/tests/config/small_tabs.toml b/tests/config/small_tabs.toml
index 08a0c22cc10..c5122b760a0 100644
--- a/tests/config/small_tabs.toml
+++ b/tests/config/small_tabs.toml
@@ -7,6 +7,7 @@ fn_brace_style = "SameLineWhere"
 fn_return_indent = "WithArgs"
 fn_args_paren_newline = true
 fn_args_density = "Tall"
+fn_args_layout = "Visual"
 fn_arg_indent = "Visual"
 where_density = "Tall"
 where_indent = "Tabbed"
@@ -15,7 +16,7 @@ where_pred_indent = "Visual"
 generics_indent = "Visual"
 struct_trailing_comma = "Vertical"
 struct_lit_trailing_comma = "Vertical"
-struct_lit_style = "BlockIndent"
+struct_lit_style = "Block"
 enum_trailing_comma = true
 report_todo = "Always"
 report_fixme = "Never"
diff --git a/tests/source/fn-custom-6.rs b/tests/source/fn-custom-6.rs
new file mode 100644
index 00000000000..1042fa5bd88
--- /dev/null
+++ b/tests/source/fn-custom-6.rs
@@ -0,0 +1,36 @@
+// rustfmt-fn_args_layout: Block
+// rustfmt-where_indent: Inherit
+// rustfmt-fn_brace_style: PreferSameLine
+// Test different indents.
+
+fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) {
+    foo();
+}
+
+fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) {
+    bar();
+}
+
+fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String {
+    foo();
+}
+
+fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) -> String {
+    bar();
+}
+
+fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) where T: UUUUUUUUUUU {
+    foo();
+}
+
+fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) where T: UUUUUUUUUUU {
+    bar();
+}
+
+fn foo(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb) -> String where T: UUUUUUUUUUU {
+    foo();
+}
+
+fn bar(a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb, c: Cccccccccccccccccc, d: Dddddddddddddddd, e: Eeeeeeeeeeeeeee) -> String where T: UUUUUUUUUUU {
+    bar();
+}
diff --git a/tests/source/struct_lits_visual.rs b/tests/source/struct_lits_visual.rs
index ea76a088a32..180a1229faa 100644
--- a/tests/source/struct_lits_visual.rs
+++ b/tests/source/struct_lits_visual.rs
@@ -1,4 +1,4 @@
-// rustfmt-struct_lit_style: VisualIndent
+// rustfmt-struct_lit_style: Visual
 
 // Struct literal expressions.
 
diff --git a/tests/target/fn-custom-6.rs b/tests/target/fn-custom-6.rs
new file mode 100644
index 00000000000..bea50c6a3ce
--- /dev/null
+++ b/tests/target/fn-custom-6.rs
@@ -0,0 +1,70 @@
+// rustfmt-fn_args_layout: Block
+// rustfmt-where_indent: Inherit
+// rustfmt-fn_brace_style: PreferSameLine
+// Test different indents.
+
+fn foo(
+    a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
+) {
+    foo();
+}
+
+fn bar(
+    a: Aaaaaaaaaaaaaa,
+    b: Bbbbbbbbbbbbbb,
+    c: Cccccccccccccccccc,
+    d: Dddddddddddddddd,
+    e: Eeeeeeeeeeeeeee
+) {
+    bar();
+}
+
+fn foo(
+    a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
+) -> String {
+    foo();
+}
+
+fn bar(
+    a: Aaaaaaaaaaaaaa,
+    b: Bbbbbbbbbbbbbb,
+    c: Cccccccccccccccccc,
+    d: Dddddddddddddddd,
+    e: Eeeeeeeeeeeeeee
+) -> String {
+    bar();
+}
+
+fn foo(
+    a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
+) where T: UUUUUUUUUUU {
+    foo();
+}
+
+fn bar(
+    a: Aaaaaaaaaaaaaa,
+    b: Bbbbbbbbbbbbbb,
+    c: Cccccccccccccccccc,
+    d: Dddddddddddddddd,
+    e: Eeeeeeeeeeeeeee
+) where T: UUUUUUUUUUU {
+    bar();
+}
+
+fn foo(
+    a: Aaaaaaaaaaaaaa, b: Bbbbbbbbbbbbbb
+) -> String
+where T: UUUUUUUUUUU {
+    foo();
+}
+
+fn bar(
+    a: Aaaaaaaaaaaaaa,
+    b: Bbbbbbbbbbbbbb,
+    c: Cccccccccccccccccc,
+    d: Dddddddddddddddd,
+    e: Eeeeeeeeeeeeeee
+) -> String
+where T: UUUUUUUUUUU {
+    bar();
+}
diff --git a/tests/target/struct_lits_visual.rs b/tests/target/struct_lits_visual.rs
index 77467a40ce7..4274c916777 100644
--- a/tests/target/struct_lits_visual.rs
+++ b/tests/target/struct_lits_visual.rs
@@ -1,4 +1,4 @@
-// rustfmt-struct_lit_style: VisualIndent
+// rustfmt-struct_lit_style: Visual
 
 // Struct literal expressions.