2017-01-15 19:50:27 -06:00
|
|
|
// rustfmt-normalize_comments: true
|
2015-11-09 13:03:01 -06:00
|
|
|
// rustfmt-wrap_comments: true
|
2017-02-19 12:57:02 -06:00
|
|
|
// rustfmt-error_on_line_overflow: false
|
2015-05-24 18:03:26 -05:00
|
|
|
|
|
|
|
/// A Doc comment
|
|
|
|
#[AnAttribute]
|
|
|
|
pub struct Foo {
|
|
|
|
#[rustfmt_skip]
|
|
|
|
f : SomeType, // Comment beside a field
|
|
|
|
f: SomeType, // Comment beside a field
|
|
|
|
// Comment on a field
|
|
|
|
#[AnAttribute]
|
|
|
|
g: SomeOtherType,
|
|
|
|
/// A doc comment on a field
|
|
|
|
h: AThirdType,
|
2015-06-10 16:17:59 -05:00
|
|
|
pub i: TypeForPublicField,
|
2015-05-24 18:03:26 -05:00
|
|
|
}
|
|
|
|
|
2017-05-26 19:36:25 -05:00
|
|
|
// #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>,
|
|
|
|
}
|
|
|
|
|
2015-05-24 18:03:26 -05:00
|
|
|
struct Bar;
|
|
|
|
|
2015-06-23 08:58:58 -05:00
|
|
|
struct NewType(Type, OtherType);
|
|
|
|
|
|
|
|
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>
|
|
|
|
(
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Comment
|
|
|
|
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
|
|
|
|
#[AnAttr]
|
|
|
|
// Comment
|
|
|
|
/// Testdoc
|
|
|
|
G,
|
|
|
|
pub W,
|
|
|
|
);
|
|
|
|
|
2015-10-18 17:25:38 -05:00
|
|
|
struct Tuple(// Comment 1
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
// Comment 2
|
|
|
|
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB);
|
2015-06-23 08:58:58 -05:00
|
|
|
|
2015-05-24 18:03:26 -05:00
|
|
|
// With a where clause and generics.
|
|
|
|
pub struct Foo<'a, Y: Baz>
|
|
|
|
where X: Whatever
|
|
|
|
{
|
|
|
|
f: SomeType, // Comment beside a field
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Baz {
|
|
|
|
a: A, // Comment A
|
|
|
|
b: B, // Comment B
|
|
|
|
c: C, // Comment C
|
|
|
|
}
|
|
|
|
|
2015-09-01 21:11:19 -05:00
|
|
|
struct Baz {
|
|
|
|
a: A, // Comment A
|
|
|
|
|
|
|
|
b: B, // Comment B
|
|
|
|
|
|
|
|
c: C, // Comment C
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Baz {
|
|
|
|
a: A,
|
|
|
|
|
|
|
|
b: B,
|
|
|
|
c: C,
|
|
|
|
|
|
|
|
d: D,
|
|
|
|
}
|
|
|
|
|
2015-05-24 18:03:26 -05:00
|
|
|
struct Baz {
|
|
|
|
// Comment A
|
|
|
|
a: A,
|
2015-09-01 21:11:19 -05:00
|
|
|
|
2015-05-24 18:03:26 -05:00
|
|
|
// Comment B
|
|
|
|
b: B,
|
|
|
|
// Comment C
|
|
|
|
c: C,
|
|
|
|
}
|
2015-06-23 08:58:58 -05:00
|
|
|
|
|
|
|
// Will this be a one-liner?
|
|
|
|
struct Tuple(A /* Comment */, B);
|
2015-08-21 09:28:32 -05:00
|
|
|
|
|
|
|
pub struct State<F: FnMut() -> time::Timespec> {
|
|
|
|
now: F,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct State<F: FnMut() -> ()> {
|
|
|
|
now: F,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct State<F: FnMut()> {
|
|
|
|
now: F,
|
|
|
|
}
|
2015-09-25 09:53:44 -05:00
|
|
|
|
|
|
|
struct Palette {
|
2016-05-02 03:54:25 -05:00
|
|
|
/// A map of indizes in the palette to a count of pixels in approximately
|
|
|
|
/// that color
|
2015-09-25 09:53:44 -05:00
|
|
|
foo: i32,
|
|
|
|
}
|
2015-10-07 18:23:07 -05:00
|
|
|
|
|
|
|
// Splitting a single line comment into a block previously had a misalignment
|
|
|
|
// when the field had attributes
|
|
|
|
struct FieldsWithAttributes {
|
|
|
|
// Pre Comment
|
|
|
|
#[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 */
|
|
|
|
}
|
2015-10-18 17:25:38 -05:00
|
|
|
|
|
|
|
struct Deep {
|
2017-03-29 06:15:27 -05:00
|
|
|
deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep:
|
|
|
|
node::Handle<IdRef<'id, Node<K, V>>, Type, NodeType>,
|
2015-10-18 17:25:38 -05:00
|
|
|
}
|
2015-11-09 00:00:04 -06:00
|
|
|
|
|
|
|
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);
|
2015-11-13 07:31:20 -06:00
|
|
|
|
|
|
|
mod m {
|
|
|
|
struct X<T>
|
|
|
|
where T: Sized
|
|
|
|
{
|
|
|
|
a: T,
|
|
|
|
}
|
|
|
|
}
|
2015-11-22 15:55:57 -06:00
|
|
|
|
|
|
|
struct Foo<T>(TTTTTTTTTTTTTTTTTTT,
|
|
|
|
/// Qux
|
|
|
|
UUUUUUUUUUUUUUUUUUU);
|
2015-12-05 18:11:26 -06:00
|
|
|
|
|
|
|
struct Issue677 {
|
|
|
|
pub ptr: *const libc::c_void,
|
|
|
|
pub trace: fn(obj: *const libc::c_void, tracer: *mut JSTracer),
|
|
|
|
}
|
2016-04-11 14:05:54 -05:00
|
|
|
|
|
|
|
struct Foo {}
|
2017-01-08 21:11:12 -06:00
|
|
|
struct Foo {}
|
|
|
|
struct Foo {
|
|
|
|
// comment
|
|
|
|
}
|
|
|
|
struct Foo {
|
|
|
|
// trailing space ->
|
|
|
|
}
|
|
|
|
struct Foo { /* comment */ }
|
2017-04-14 08:39:20 -05:00
|
|
|
struct Foo( /* comment */ );
|
2017-03-29 06:15:27 -05:00
|
|
|
|
|
|
|
struct LongStruct {
|
|
|
|
a: A,
|
|
|
|
the_quick_brown_fox_jumps_over_the_lazy_dog:
|
|
|
|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Deep {
|
|
|
|
deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep:
|
|
|
|
node::Handle<IdRef<'id, Node<Key, Value>>, Type, NodeType>,
|
|
|
|
}
|
2017-03-31 07:57:29 -05:00
|
|
|
|
|
|
|
struct Foo<C = ()>(String);
|
2017-05-03 23:52:35 -05:00
|
|
|
|
|
|
|
// #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 });
|
|
|
|
}
|