Allman struct and enum field style
This commit is contained in:
@@ -289,12 +289,8 @@ enum_field = _{
|
||||
| enum_named
|
||||
}
|
||||
|
||||
enum_fields = _{
|
||||
enum_field ~ ";"
|
||||
}
|
||||
|
||||
enum_decl = {
|
||||
visibility? ~ "enum" ~ identifier ~ generics_decl? ~ "{" ~ enum_fields? ~ "}"
|
||||
visibility? ~ "enum" ~ identifier ~ generics_decl? ~ "{" ~ (enum_field ~ ";")* ~ "}"
|
||||
}
|
||||
|
||||
// ======================================================
|
||||
|
||||
@@ -4,7 +4,7 @@ pub module attribute_test;
|
||||
#[derive(Debug)]
|
||||
pub struct Debuggable
|
||||
{
|
||||
i32 value,
|
||||
i32 value;
|
||||
}
|
||||
|
||||
pub void test_derive_attribute()
|
||||
|
||||
@@ -3,8 +3,8 @@ pub module enum_test;
|
||||
|
||||
enum OptionInt
|
||||
{
|
||||
None,
|
||||
Some(i32),
|
||||
None;
|
||||
Some(i32);
|
||||
}
|
||||
|
||||
pub void test_enum_named()
|
||||
@@ -35,8 +35,13 @@ pub void test_enum_tuple()
|
||||
|
||||
enum Shape
|
||||
{
|
||||
Circle {i32 radius},
|
||||
Rect {i32 w, i32 h},
|
||||
Circle {
|
||||
i32 radius;
|
||||
};
|
||||
Rect {
|
||||
i32 w;
|
||||
i32 h;
|
||||
};
|
||||
}
|
||||
|
||||
pub void test_enum_struct()
|
||||
@@ -68,9 +73,9 @@ pub void test_enum_struct()
|
||||
|
||||
enum Color
|
||||
{
|
||||
Red,
|
||||
Green,
|
||||
Blue,
|
||||
Red;
|
||||
Green;
|
||||
Blue;
|
||||
}
|
||||
|
||||
pub void test_enum_eq()
|
||||
|
||||
@@ -3,8 +3,8 @@ pub module impl_test;
|
||||
|
||||
struct Vector2
|
||||
{
|
||||
i32 x,
|
||||
i32 y,
|
||||
i32 x;
|
||||
i32 y;
|
||||
}
|
||||
|
||||
impl Vector2
|
||||
|
||||
@@ -3,8 +3,8 @@ pub module struct_test;
|
||||
|
||||
struct Point
|
||||
{
|
||||
i32 x,
|
||||
i32 y,
|
||||
i32 x;
|
||||
i32 y;
|
||||
}
|
||||
|
||||
pub void test_struct_create_access()
|
||||
@@ -40,8 +40,8 @@ pub void test_struct_destructure()
|
||||
|
||||
struct Line
|
||||
{
|
||||
Point start,
|
||||
Point end,
|
||||
Point start;
|
||||
Point end;
|
||||
}
|
||||
|
||||
pub void test_struct_nested()
|
||||
|
||||
@@ -13,7 +13,7 @@ trait Greet : Speak
|
||||
|
||||
struct Dog
|
||||
{
|
||||
String name,
|
||||
String name;
|
||||
}
|
||||
|
||||
impl Speak for Dog
|
||||
|
||||
Reference in New Issue
Block a user