diff options
| author | Marcus Klaas <mail@marcusklaas.nl> | 2015-06-23 15:58:58 +0200 |
|---|---|---|
| committer | Marcus Klaas <mail@marcusklaas.nl> | 2015-06-23 16:54:42 +0200 |
| commit | 0ef5db9496fddfb5a26131a5a4dc8b2fcce40dde (patch) | |
| tree | 56790c407f88ed089ef319cf1ee414a3fa69de38 /tests/source | |
| parent | 66c6fe53346c575cd6d7a4ce581b1e7ecda5e7bb (diff) | |
Format tuple-like structs
Diffstat (limited to 'tests/source')
| -rw-r--r-- | tests/source/fn-simple.rs | 11 | ||||
| -rw-r--r-- | tests/source/multiple.rs | 2 | ||||
| -rw-r--r-- | tests/source/structs.rs | 70 |
3 files changed, 82 insertions, 1 deletions
diff --git a/tests/source/fn-simple.rs b/tests/source/fn-simple.rs new file mode 100644 index 00000000000..9bcf3166722 --- /dev/null +++ b/tests/source/fn-simple.rs @@ -0,0 +1,11 @@ + +fn simple(/*pre-comment on a function!?*/ i: i32/*yes, it's possible! */ + ,response: NoWay /* hose */) {"cool"} + + +fn weird_comment(/* /*/ double level */ comment */ x: Hello /*/*/* tripple, even */*/*/, +// Does this work? +y: World +) { + simple(/* does this preserve comments now? */ 42, NoWay) +} diff --git a/tests/source/multiple.rs b/tests/source/multiple.rs index 024817353da..2ba2b0f9930 100644 --- a/tests/source/multiple.rs +++ b/tests/source/multiple.rs @@ -43,7 +43,7 @@ fn qux(a: dadsfa, // Comment 1 /// Blah blah blah. impl Bar { - fn foo(&mut self, a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a + fn foo(&mut self, a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a b: sdfasdfsdfasfs /*closing comment*/ ) -> isize {} /// Blah blah blah. diff --git a/tests/source/structs.rs b/tests/source/structs.rs new file mode 100644 index 00000000000..ace13fe2889 --- /dev/null +++ b/tests/source/structs.rs @@ -0,0 +1,70 @@ + + /// 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, + pub i: TypeForPublicField +} + +struct Bar; + +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, +); + +struct Tuple(/*Comment 1*/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, + /* Comment 2 */ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,); + +// 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 +} + +struct Baz +{ + // Comment A + a: A, + // Comment B +b: B, + // Comment C + c: C,} + +// Will this be a one-liner? +struct Tuple( + A, //Comment + B +); |
