]> git.lizzy.rs Git - rust.git/commitdiff
Comments.
authorPavel Sountsov <siege@google.com>
Tue, 17 Nov 2015 07:18:07 +0000 (23:18 -0800)
committerSiegeLord <slabode@aim.com>
Tue, 17 Nov 2015 07:18:07 +0000 (23:18 -0800)
- Move the option
- Add some more tests (don't pass yet)

src/config.rs
tests/source/item-brace-style-next-line.rs [new file with mode: 0644]
tests/source/item-brace-style-same-line.rs [new file with mode: 0644]
tests/source/item-brace-style.rs [deleted file]
tests/target/item-brace-style-next-line.rs [new file with mode: 0644]
tests/target/item-brace-style-same-line.rs [new file with mode: 0644]
tests/target/item-brace-style.rs [deleted file]

index 7a64ab1591647aa041752fc6ada8c1ab232783d8..3990e1af6ad6b5728ad968d58324a54a34693222 100644 (file)
@@ -266,6 +266,7 @@ fn default() -> Config {
         "Maximum width in the body of a struct lit before falling back to vertical formatting";
     newline_style: NewlineStyle, NewlineStyle::Unix, "Unix or Windows line endings";
     fn_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for functions";
+    item_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for structs and enums";
     fn_return_indent: ReturnIndent, ReturnIndent::WithArgs,
         "Location of return type in function declaration";
     fn_args_paren_newline: bool, true, "If function argument parenthesis goes on a newline";
@@ -302,5 +303,4 @@ fn default() -> Config {
     take_source_hints: bool, true, "Retain some formatting characteristics from the source code";
     hard_tabs: bool, false, "Use tab characters for indentation, spaces for alignment";
     wrap_comments: bool, false, "Break comments to fit on the line";
-    item_brace_style: BraceStyle, BraceStyle::SameLineWhere, "Brace style for structs and enums";
 }
diff --git a/tests/source/item-brace-style-next-line.rs b/tests/source/item-brace-style-next-line.rs
new file mode 100644 (file)
index 0000000..96a6283
--- /dev/null
@@ -0,0 +1,29 @@
+// rustfmt-item_brace_style: AlwaysNextLine
+
+mod M {
+    enum A {
+        A,
+    }
+
+    struct B {
+        b: i32,
+    }
+
+    // For empty enums and structs, the brace remains on the same line.
+    enum C {}
+
+    struct D {}
+
+    enum A<T> where T: Copy {
+        A,
+    }
+
+    struct B<T> where T: Copy {
+        b: i32,
+    }
+
+    // For empty enums and structs, the brace remains on the same line.
+    enum C<T> where T: Copy {}
+
+    struct D<T> where T: Copy {}
+}
diff --git a/tests/source/item-brace-style-same-line.rs b/tests/source/item-brace-style-same-line.rs
new file mode 100644 (file)
index 0000000..636a584
--- /dev/null
@@ -0,0 +1,29 @@
+// rustfmt-item_brace_style: PreferSameLine
+
+mod M {
+    enum A
+    {
+        A,
+    }
+
+    struct B
+    {
+        b: i32,
+    }
+
+    enum C {}
+
+    struct D {}
+
+    enum A<T> where T: Copy {
+        A,
+    }
+
+    struct B<T> where T: Copy {
+        b: i32,
+    }
+
+    enum C<T> where T: Copy {}
+
+    struct D<T> where T: Copy {}
+}
diff --git a/tests/source/item-brace-style.rs b/tests/source/item-brace-style.rs
deleted file mode 100644 (file)
index 37b02f0..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// rustfmt-item_brace_style: AlwaysNextLine
-
-mod M {
-    enum A {
-        A,
-    }
-
-    struct B {
-        b: i32,
-    }
-
-    // For empty enums and structs, the brace remains on the same line.
-    enum C {}
-
-    struct D {}
-}
diff --git a/tests/target/item-brace-style-next-line.rs b/tests/target/item-brace-style-next-line.rs
new file mode 100644 (file)
index 0000000..a5c2410
--- /dev/null
@@ -0,0 +1,39 @@
+// rustfmt-item_brace_style: AlwaysNextLine
+
+mod M {
+    enum A
+    {
+        A,
+    }
+
+    struct B
+    {
+        b: i32,
+    }
+
+    // For empty enums and structs, the brace remains on the same line.
+    enum C {}
+
+    struct D {}
+
+    enum A<T>
+        where T: Copy
+    {
+        A,
+    }
+
+    struct B<T>
+        where T: Copy
+    {
+        b: i32,
+    }
+
+    // For empty enums and structs, the brace remains on the same line.
+    enum C<T>
+        where T: Copy
+    {}
+
+    struct D<T>
+        where T: Copy
+    {}
+}
diff --git a/tests/target/item-brace-style-same-line.rs b/tests/target/item-brace-style-same-line.rs
new file mode 100644 (file)
index 0000000..b38bd2e
--- /dev/null
@@ -0,0 +1,31 @@
+// rustfmt-item_brace_style: PreferSameLine
+
+mod M {
+    enum A {
+        A,
+    }
+
+    struct B {
+        b: i32,
+    }
+
+    enum C {}
+
+    struct D {}
+
+    enum A<T>
+        where T: Copy {
+        A,
+    }
+
+    struct B<T>
+        where T: Copy {
+        b: i32,
+    }
+
+    enum C<T>
+        where T: Copy {}
+
+    struct D<T>
+        where T: Copy {}
+}
diff --git a/tests/target/item-brace-style.rs b/tests/target/item-brace-style.rs
deleted file mode 100644 (file)
index 006d6b4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// rustfmt-item_brace_style: AlwaysNextLine
-
-mod M {
-    enum A
-    {
-        A,
-    }
-
-    struct B
-    {
-        b: i32,
-    }
-
-    // For empty enums and structs, the brace remains on the same line.
-    enum C {}
-
-    struct D {}
-}