From 863ea0408d9f6099ff3f14ee79dae43f305c9fd1 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 19 Mar 2024 22:47:52 +0100 Subject: [PATCH] fix: macro allows zero flat, removed invalid type --- src/activitystream/link.rs | 4 ++-- src/activitystream/mod.rs | 5 ++--- src/activitystream/object/activity/accept.rs | 4 ++-- src/activitystream/object/activity/ignore.rs | 4 ++-- src/activitystream/object/activity/intransitive.rs | 4 ++-- src/activitystream/object/activity/mod.rs | 4 ++-- src/activitystream/object/activity/offer.rs | 4 ++-- src/activitystream/object/activity/reject.rs | 4 ++-- src/activitystream/object/actor.rs | 4 ++-- src/activitystream/object/collection/mod.rs | 4 ++-- src/activitystream/object/document.rs | 4 ++-- src/activitystream/object/mod.rs | 4 ++-- src/activitystream/types.rs | 2 +- 13 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/activitystream/link.rs b/src/activitystream/link.rs index 90411181..bf52e840 100644 --- a/src/activitystream/link.rs +++ b/src/activitystream/link.rs @@ -3,8 +3,8 @@ use crate::strenum; strenum! { pub enum LinkType { Link, - Mention - } + Mention; + }; } pub trait Link : super::Base { diff --git a/src/activitystream/mod.rs b/src/activitystream/mod.rs index 6bb53560..1e72c6bf 100644 --- a/src/activitystream/mod.rs +++ b/src/activitystream/mod.rs @@ -13,11 +13,10 @@ use crate::strenum; strenum! { pub enum BaseType { - Invalid - + ; Object(ObjectType), Link(LinkType) - } + }; } pub trait Base { diff --git a/src/activitystream/object/activity/accept.rs b/src/activitystream/object/activity/accept.rs index 5a693280..aebbae4c 100644 --- a/src/activitystream/object/activity/accept.rs +++ b/src/activitystream/object/activity/accept.rs @@ -3,8 +3,8 @@ use crate::strenum; strenum! { pub enum AcceptType { Accept, - TentativeAccept - } + TentativeAccept; + }; } pub trait Accept : super::Activity { diff --git a/src/activitystream/object/activity/ignore.rs b/src/activitystream/object/activity/ignore.rs index fe6f3435..5c93a9c1 100644 --- a/src/activitystream/object/activity/ignore.rs +++ b/src/activitystream/object/activity/ignore.rs @@ -3,8 +3,8 @@ use crate::strenum; strenum! { pub enum IgnoreType { Ignore, - Block - } + Block; + }; } pub trait Ignore : super::Activity { diff --git a/src/activitystream/object/activity/intransitive.rs b/src/activitystream/object/activity/intransitive.rs index 2d513011..f0bafbbf 100644 --- a/src/activitystream/object/activity/intransitive.rs +++ b/src/activitystream/object/activity/intransitive.rs @@ -5,8 +5,8 @@ strenum! { IntransitiveActivity, Arrive, Question, - Travel - } + Travel; + }; } pub trait IntransitiveActivity : super::Activity { diff --git a/src/activitystream/object/activity/mod.rs b/src/activitystream/object/activity/mod.rs index c5b43ec7..6f394c41 100644 --- a/src/activitystream/object/activity/mod.rs +++ b/src/activitystream/object/activity/mod.rs @@ -36,14 +36,14 @@ strenum! { Remove, Undo, Update, - View + View; IntransitiveActivity(IntransitiveActivityType), Accept(AcceptType), Ignore(IgnoreType), Offer(OfferType), Reject(RejectType) - } + }; } pub trait Activity : super::Object { diff --git a/src/activitystream/object/activity/offer.rs b/src/activitystream/object/activity/offer.rs index 5422242c..142cbacb 100644 --- a/src/activitystream/object/activity/offer.rs +++ b/src/activitystream/object/activity/offer.rs @@ -3,8 +3,8 @@ use crate::strenum; strenum! { pub enum OfferType { Offer, - Invite - } + Invite; + }; } pub trait Offer : super::Activity { diff --git a/src/activitystream/object/activity/reject.rs b/src/activitystream/object/activity/reject.rs index 7e5dd664..1f430be2 100644 --- a/src/activitystream/object/activity/reject.rs +++ b/src/activitystream/object/activity/reject.rs @@ -3,8 +3,8 @@ use crate::strenum; strenum! { pub enum RejectType { Reject, - TentativeReject - } + TentativeReject; + }; } pub trait Reject : super::Activity { diff --git a/src/activitystream/object/actor.rs b/src/activitystream/object/actor.rs index a89ea640..066fc271 100644 --- a/src/activitystream/object/actor.rs +++ b/src/activitystream/object/actor.rs @@ -8,8 +8,8 @@ strenum! { Group, Organization, Person, - Object - } + Object; + }; } pub trait Profile : super::Object { diff --git a/src/activitystream/object/collection/mod.rs b/src/activitystream/object/collection/mod.rs index d653bc17..f9acbbf3 100644 --- a/src/activitystream/object/collection/mod.rs +++ b/src/activitystream/object/collection/mod.rs @@ -9,8 +9,8 @@ strenum! { Collection, CollectionPage, OrderedCollection, - OrderedCollectionPage - } + OrderedCollectionPage; + }; } pub trait Collection : super::Object { diff --git a/src/activitystream/object/document.rs b/src/activitystream/object/document.rs index 346c46e1..1743d6be 100644 --- a/src/activitystream/object/document.rs +++ b/src/activitystream/object/document.rs @@ -6,8 +6,8 @@ strenum! { Audio, Image, Page, - Video - } + Video; + }; } pub trait Document : super::Object { diff --git a/src/activitystream/object/mod.rs b/src/activitystream/object/mod.rs index 02965a7c..6402477e 100644 --- a/src/activitystream/object/mod.rs +++ b/src/activitystream/object/mod.rs @@ -29,13 +29,13 @@ strenum! { Place, Profile, Relationship, - Tombstone + Tombstone; Activity(ActivityType), Actor(ActorType), Collection(CollectionType), Document(DocumentType) - } + }; } pub trait Object : super::Base { diff --git a/src/activitystream/types.rs b/src/activitystream/types.rs index 58e863cf..b90e3c11 100644 --- a/src/activitystream/types.rs +++ b/src/activitystream/types.rs @@ -16,7 +16,7 @@ impl From for sea_orm::TryGetError { #[macro_export] macro_rules! strenum { - ( $(pub enum $enum_name:ident { $($flat:ident),+ $($deep:ident($inner:ident)),*})+ ) => { + ( $(pub enum $enum_name:ident { $($flat:ident),* ; $($deep:ident($inner:ident)),* };)+ ) => { $( #[derive(PartialEq, Eq, Debug, Clone, Copy)] pub enum $enum_name {