Skip to content

Commit

Permalink
Delete From impls of ast enums
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 15, 2024
1 parent dd3b93d commit 5b4e2f3
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,42 +60,11 @@ macro_rules! ast_enum_of_structs {

$(#[$enum_attr])* $pub $enum $name $body

ast_enum_of_structs_impl!($name $body);

#[cfg(feature = "printing")]
generate_to_tokens!(() tokens $name $body);
};
}

macro_rules! ast_enum_of_structs_impl {
(
$name:ident {
$(
$(#[cfg $cfg_attr:tt])*
$(#[doc $($doc_attr:tt)*])*
$variant:ident $( ($member:ident) )*,
)*
}
) => {
$($(
ast_enum_from_struct!($name::$variant, $member);
)*)*
};
}

macro_rules! ast_enum_from_struct {
// No From<TokenStream> for verbatim variants.
($name:ident::Verbatim, $member:ident) => {};

($name:ident::$variant:ident, $member:ident) => {
impl From<$member> for $name {
fn from(e: $member) -> $name {
$name::$variant(e)
}
}
};
}

#[cfg(feature = "printing")]
macro_rules! generate_to_tokens {
(
Expand Down

0 comments on commit 5b4e2f3

Please sign in to comment.