Commit b35beec9 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

macros: allow trailing commas

Actually force them, but that's the style anyways.
parent 7e47a121
......@@ -36,7 +36,7 @@ macro_rules! impl_id {
}
macro_rules! enum_serialize {
( $name:ident -> $desc:expr, $( $value:ident => $str:expr ),+ ) => {
( $name:ident -> $desc:expr, $( $value:ident => $str:expr, )+ ) => {
impl $name {
pub fn as_str(&self) -> &'static str {
match *self {
......
......@@ -30,7 +30,7 @@ enum_serialize!(ProjectEvent -> "project event",
Create => "project_create",
Destroy => "project_destroy",
Rename => "project_rename",
Transfer => "project_transfer"
Transfer => "project_transfer",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
......@@ -42,7 +42,7 @@ pub enum ProjectVisibility {
enum_serialize!(ProjectVisibility -> "project visibility",
Internal => "internal",
Private => "private",
Public => "public"
Public => "public",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -68,7 +68,7 @@ pub enum ProjectMemberEvent {
}
enum_serialize!(ProjectMemberEvent -> "project member event",
Add => "user_add_to_team",
Remove => "user_remove_from_team"
Remove => "user_remove_from_team",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
......@@ -90,7 +90,7 @@ enum_serialize!(HumanAccessLevel -> "human access level",
Reporter => "Reporter",
Developer => "Developer",
Master => "Master",
Owner => "Owner"
Owner => "Owner",
);
impl From<HumanAccessLevel> for AccessLevel {
......@@ -129,7 +129,7 @@ pub enum UserEvent {
}
enum_serialize!(UserEvent -> "user event",
Create => "user_create",
Destroy => "user_destroy"
Destroy => "user_destroy",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -150,7 +150,7 @@ pub enum KeyEvent {
}
enum_serialize!(KeyEvent -> "key event",
Create => "key_create",
Destroy => "key_destroy"
Destroy => "key_destroy",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -170,7 +170,7 @@ pub enum GroupEvent {
}
enum_serialize!(GroupEvent -> "group event",
Create => "group_create",
Destroy => "group_destroy"
Destroy => "group_destroy",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -192,7 +192,7 @@ pub enum GroupMemberEvent {
}
enum_serialize!(GroupMemberEvent -> "group member event",
Add => "user_add_to_group",
Remove => "user_remove_from_group"
Remove => "user_remove_from_group",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -217,7 +217,7 @@ pub enum PushEvent {
}
enum_serialize!(PushEvent -> "push event",
Push => "push",
TagPush => "tag_push"
TagPush => "tag_push",
);
#[derive(Serialize, Deserialize, Debug)]
......
......@@ -43,7 +43,7 @@ pub enum UserState {
enum_serialize!(UserState -> "user state",
Active => "active",
Blocked => "blocked",
LdapBlocked => "ldap_blocked"
LdapBlocked => "ldap_blocked",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -654,7 +654,7 @@ pub enum ObjectType {
}
enum_serialize!(ObjectType -> "object type",
Tree => "tree",
Blob => "blob"
Blob => "blob",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -751,7 +751,7 @@ pub enum MilestoneState {
}
enum_serialize!(MilestoneState -> "milestone type",
Active => "active",
Closed => "closed"
Closed => "closed",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -780,7 +780,7 @@ pub enum IssueState {
enum_serialize!(IssueState -> "issue type",
Opened => "opened",
Closed => "closed",
Reopened => "reopened"
Reopened => "reopened",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -825,7 +825,7 @@ pub enum MergeStatus {
enum_serialize!(MergeStatus -> "merge status",
Unchecked => "unchecked",
CanBeMerged => "can_be_merged",
CannotBeMerged => "cannot_be_merged"
CannotBeMerged => "cannot_be_merged",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
......@@ -841,7 +841,7 @@ enum_serialize!(MergeRequestState -> "merge request state",
Closed => "closed",
Reopened => "reopened",
Merged => "merged",
Locked => "locked"
Locked => "locked",
);
fn bool_false() -> bool {
......@@ -971,7 +971,7 @@ enum_serialize!(NoteType -> "note type",
Commit => "commit",
Issue => "issue",
MergeRequest => "merge_request",
Snippet => "snippet"
Snippet => "snippet",
);
#[derive(Clone, PartialEq, Eq)]
......@@ -1046,7 +1046,7 @@ pub enum LineType {
}
enum_serialize!(LineType -> "line type",
New => "new",
Old => "old"
Old => "old",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -1082,7 +1082,7 @@ enum_serialize!(StatusState -> "status state",
Running => "running",
Success => "success",
Failed => "failed",
Canceled => "canceled"
Canceled => "canceled",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -1115,7 +1115,7 @@ enum_serialize!(EventTargetType -> "event target type",
Issue => "issue",
MergeRequest => "merge_request",
Snippet => "snippet",
ProjectSnippet => "project_snippet"
ProjectSnippet => "project_snippet",
);
#[derive(Clone, PartialEq, Eq)]
......@@ -1190,7 +1190,7 @@ pub enum NamespaceKind {
}
enum_serialize!(NamespaceKind -> "namespace kind",
User => "user",
Group => "group"
Group => "group",
);
#[derive(Clone, Copy, PartialEq, Eq)]
......
......@@ -157,7 +157,7 @@ pub enum IssueAction {
Update => "update",
Open => "open",
Close => "close",
Reopen => "reopen"
Reopen => "reopen",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -208,7 +208,7 @@ enum_serialize!(MergeRequestAction -> "merge request action",
Open => "open",
Close => "close",
Reopen => "reopen",
Merge => "merge"
Merge => "merge",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -294,7 +294,7 @@ pub enum SnippetType {
}
enum_serialize!(SnippetType -> "snippet type",
Project => "ProjectSnippet",
Personal => "PersonalSnippet"
Personal => "PersonalSnippet",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -318,7 +318,7 @@ pub enum WikiPageAction {
}
enum_serialize!(WikiPageAction -> "wiki page action",
Create => "create",
Update => "update"
Update => "update",
);
#[derive(Serialize, Deserialize, Debug)]
......@@ -371,7 +371,7 @@ enum_serialize!(NoteHookType -> "note hook type",
Commit => "Commit",
Issue => "Issue",
MergeRequest => "MergeRequest",
Snippet => "Snippet"
Snippet => "Snippet",
);
#[derive(Serialize, Deserialize, Debug)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment