Allman struct and enum field style

This commit is contained in:
2026-07-04 09:38:13 +02:00
parent 409301b3d6
commit 4f3966d8d8
6 changed files with 21 additions and 20 deletions
+1 -5
View File
@@ -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 ~ ";")* ~ "}"
}
// ======================================================
+1 -1
View File
@@ -4,7 +4,7 @@ pub module attribute_test;
#[derive(Debug)]
pub struct Debuggable
{
i32 value,
i32 value;
}
pub void test_derive_attribute()
+12 -7
View File
@@ -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()
+2 -2
View File
@@ -3,8 +3,8 @@ pub module impl_test;
struct Vector2
{
i32 x,
i32 y,
i32 x;
i32 y;
}
impl Vector2
+4 -4
View File
@@ -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()
+1 -1
View File
@@ -13,7 +13,7 @@ trait Greet : Speak
struct Dog
{
String name,
String name;
}
impl Speak for Dog