rust/tests/target/enum.rs

130 lines
3.3 KiB
Rust
Raw Normal View History

// rustfmt-wrap_comments: true
// rustfmt-error_on_line_overflow: false
2015-05-29 05:41:26 -05:00
// Enums test
#[atrr]
pub enum Test {
A,
2015-06-23 08:58:58 -05:00
B(u32, A /* comment */, SomeType),
2015-05-29 05:41:26 -05:00
/// Doc comment
C,
}
pub enum Foo<'a, Y: Baz>
where X: Whatever
{
A,
}
enum EmtpyWithComment {
// Some comment
}
// C-style enum
enum Bar {
A = 1,
#[someAttr(test)]
B = 2, // comment
C,
}
enum LongVariants {
2015-09-27 01:39:58 -05:00
First(LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOONG, // comment
2015-05-29 05:41:26 -05:00
VARIANT),
// This is the second variant
Second,
}
2015-06-23 08:58:58 -05:00
enum StructLikeVariants {
Normal(u32, String),
StructLike {
x: i32, // Test comment
// Pre-comment
#[Attr50]
y: SomeType, // Aanother Comment
},
SL { a: A },
2015-06-23 08:58:58 -05:00
}
enum X {
CreateWebGLPaintTask(Size2D<i32>,
GLContextAttributes,
IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>), /* This is a post comment */
}
pub enum EnumWithAttributes {
// This is a pre comment
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
TupleVar(usize, usize, usize), /* AAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
// Pre Comment
#[rustfmt_skip]
SkippedItem(String,String,), // Post-comment
#[another_attr]
#[attr2]
ItemStruct { x: usize, y: usize }, /* Comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
// And another
ForcedPreflight, /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
}
pub enum SingleTuple {
// Pre Comment AAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Match(usize, usize, String), /* Post-comment AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA */
}
pub enum SingleStruct {
Match { name: String, loc: usize }, // Post-comment
}
pub enum GenericEnum<I, T>
where I: Iterator<Item = T>
{
// Pre Comment
Left { list: I, root: T }, // Post-comment
Right { list: I, root: T }, // Post Comment
}
enum EmtpyWithComment {
// Some comment
}
enum TestFormatFails {
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
}
fn nested_enum_test() {
if true {
enum TestEnum {
One(usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize,
usize), /* AAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAAAAAA */
Two, /* AAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
* AAAAAAAAAAAAAAAAAA */
}
enum TestNestedFormatFail {
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
}
}
}
2015-10-18 17:25:38 -05:00
pub struct EmtpyWithComment {
// FIXME: Implement this struct
}