aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/document_tree/element_categories.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/document_tree/element_categories.rs b/src/document_tree/element_categories.rs
index 5d0cecf..df291cf 100644
--- a/src/document_tree/element_categories.rs
+++ b/src/document_tree/element_categories.rs
@@ -21,13 +21,13 @@ pub trait HasChildren<C> {
}
macro_rules! impl_into {
- ([ $( ($subentry:tt, $supcat:tt), )+ ]) => {
- $( impl_into!($subentry => $supcat); )+
+ ([ $( (($subcat:ident :: $entry:ident), $supcat:ident), )+ ]) => {
+ $( impl_into!($subcat::$entry => $supcat); )+
};
- ( ($subcat:ident :: $entry:ident) => $supcat:ident ) => {
+ ($subcat:ident :: $entry:ident => $supcat:ident ) => {
impl Into<$supcat> for $entry {
fn into(self) -> $supcat {
- $supcat::$subcat($subcat::$entry(self))
+ $supcat::$subcat(self.into())
}
}
};
@@ -36,11 +36,7 @@ macro_rules! impl_into {
macro_rules! synonymous_enum {
( $subcat:ident : $($supcat:ident),+ ; $midcat:ident : $supsupcat:ident { $($entry:ident),+ $(,)* } ) => {
synonymous_enum!($subcat : $( $supcat ),+ , $midcat { $($entry,)* });
- $( impl Into<$supsupcat> for $entry {
- fn into(self) -> $supsupcat {
- $supsupcat::$midcat($midcat::$subcat($subcat::$entry(self)))
- }
- } )+
+ $( impl_into!($midcat::$entry => $supsupcat); )+
};
( $subcat:ident : $($supcat:ident),+ { $($entry:ident),+ $(,)* } ) => {
synonymous_enum!($subcat { $( $entry, )* });