]> git.lizzy.rs Git - rust.git/blobdiff - tests/target/structs.rs
Update tests
[rust.git] / tests / target / structs.rs
index 2906d39759b7e495e113017edf6d6e97a2157d02..5f471e9a3cdfbf33c7ccddf4b5deeca92363df43 100644 (file)
@@ -1,6 +1,5 @@
 // rustfmt-normalize_comments: true
 // rustfmt-wrap_comments: true
-// rustfmt-error_on_line_overflow: false
 
 /// A Doc comment
 #[AnAttribute]
@@ -16,18 +15,45 @@ pub struct Foo {
     pub i: TypeForPublicField,
 }
 
+// #1029
+pub struct Foo {
+    #[doc(hidden)]
+    // This will NOT get deleted!
+    bar: String, // hi
+}
+
+// #1029
+struct X {
+    // `x` is an important number.
+    #[allow(unused)] // TODO: use
+    x: u32,
+}
+
+// #410
+#[allow(missing_docs)]
+pub struct Writebatch<K: Key> {
+    #[allow(dead_code)] // only used for holding the internal pointer
+    writebatch: RawWritebatch,
+    marker: PhantomData<K>,
+}
+
 struct Bar;
 
 struct NewType(Type, OtherType);
 
-struct NewInt<T: Copy>(pub i32, SomeType /* inline comment */, T /* sup */);
+struct NewInt<T: Copy>(
+    pub i32,
+    SomeType, // inline comment
+    T,        // sup
+);
 
-struct Qux<'a,
-           N: Clone + 'a,
-           E: Clone + 'a,
-           G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
-           W: Write + Copy>
-(
+struct Qux<
+    'a,
+    N: Clone + 'a,
+    E: Clone + 'a,
+    G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
+    W: Write + Copy,
+>(
     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Comment
     BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
     #[AnAttr]
@@ -37,14 +63,17 @@ struct Qux<'a,
     pub W,
 );
 
-struct Tuple(// Comment 1
-             AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
-             // Comment 2
-             BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB);
+struct Tuple(
+    // Comment 1
+    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
+    // Comment 2
+    BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
+);
 
 // With a where clause and generics.
 pub struct Foo<'a, Y: Baz>
-    where X: Whatever
+where
+    X: Whatever,
 {
     f: SomeType, // Comment beside a field
 }
@@ -83,7 +112,10 @@ struct Baz {
 }
 
 // Will this be a one-liner?
-struct Tuple(A /* Comment */, B);
+struct Tuple(
+    A, // Comment
+    B,
+);
 
 pub struct State<F: FnMut() -> time::Timespec> {
     now: F,
@@ -107,13 +139,13 @@ struct Palette {
 // when the field had attributes
 struct FieldsWithAttributes {
     // Pre Comment
-    #[rustfmt_skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
-                                      * BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
+    #[rustfmt_skip] pub host:String, /* Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB
+                                      * BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB */
     // Another pre comment
     #[attr1]
     #[attr2]
-    pub id: usize, /* CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC
-                    * CCCCCCCCCCCCCC CCCCCCCCCCCC */
+    pub id: usize, /* CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC
+                    * CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCC */
 }
 
 struct Deep {
@@ -123,38 +155,60 @@ struct Deep {
 
 struct Foo<T>(T);
 struct Foo<T>(T)
-    where T: Copy,
-          T: Eq;
-struct Foo<T>(TTTTTTTTTTTTTTTTT,
-              UUUUUUUUUUUUUUUUUUUUUUUU,
-              TTTTTTTTTTTTTTTTTTT,
-              UUUUUUUUUUUUUUUUUUU);
-struct Foo<T>(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT) where T: PartialEq;
-struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTTTT)
-    where T: PartialEq;
-struct Foo<T>(TTTTTTTTTTTTTTTTT,
-              UUUUUUUUUUUUUUUUUUUUUUUU,
-              TTTTTTTTTTTTTTTTTTT,
-              UUUUUUUUUUUUUUUUUUU)
-    where T: PartialEq;
-struct Foo<T>(TTTTTTTTTTTTTTTTT, // Foo
-              UUUUUUUUUUUUUUUUUUUUUUUU, // Bar
-              // Baz
-              TTTTTTTTTTTTTTTTTTT,
-              // Qux (FIXME #572 - doc comment)
-              UUUUUUUUUUUUUUUUUUU);
+where
+    T: Copy,
+    T: Eq;
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUUUUUUU,
+    TTTTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUU,
+);
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUUUUUUU,
+    TTTTTTTTTTTTTTTTTTT,
+)
+where
+    T: PartialEq;
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUUUUUUU,
+    TTTTTTTTTTTTTTTTTTTTT,
+)
+where
+    T: PartialEq;
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUUUUUUU,
+    TTTTTTTTTTTTTTTTTTT,
+    UUUUUUUUUUUUUUUUUUU,
+)
+where
+    T: PartialEq;
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTT,        // Foo
+    UUUUUUUUUUUUUUUUUUUUUUUU, // Bar
+    // Baz
+    TTTTTTTTTTTTTTTTTTT,
+    // Qux (FIXME #572 - doc comment)
+    UUUUUUUUUUUUUUUUUUU,
+);
 
 mod m {
     struct X<T>
-        where T: Sized
+    where
+        T: Sized,
     {
         a: T,
     }
 }
 
-struct Foo<T>(TTTTTTTTTTTTTTTTTTT,
-              /// Qux
-              UUUUUUUUUUUUUUUUUUU);
+struct Foo<T>(
+    TTTTTTTTTTTTTTTTTTT,
+    /// Qux
+    UUUUUUUUUUUUUUUUUUU,
+);
 
 struct Issue677 {
     pub ptr: *const libc::c_void,
@@ -170,7 +224,7 @@ struct Foo {
     // trailing space ->
 }
 struct Foo { /* comment */ }
-struct Foo();
+struct Foo( /* comment */ );
 
 struct LongStruct {
     a: A,
@@ -184,3 +238,34 @@ struct Deep {
 }
 
 struct Foo<C = ()>(String);
+
+// #1364
+fn foo() {
+    convex_shape.set_point(0, &Vector2f { x: 400.0, y: 100.0 });
+    convex_shape.set_point(1, &Vector2f { x: 500.0, y: 70.0 });
+    convex_shape.set_point(2, &Vector2f { x: 450.0, y: 100.0 });
+    convex_shape.set_point(3, &Vector2f { x: 580.0, y: 150.0 });
+}
+
+struct Foo {
+    aaaaa: u32, // a
+
+    b: u32,  // b
+    cc: u32, // cc
+
+    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: u32, // 1
+    yy: u32,  // comment2
+    zzz: u32, // comment3
+
+    aaaaaa: u32, // comment4
+    bb: u32,     // comment5
+    // separate
+    dd: u32, // comment7
+    c: u32,  // comment6
+
+    aaaaaaa: u32, /* multi
+                   * line
+                   * comment
+                   * */
+    b: u32, // hi
+}