diff --git a/src/idents.rs b/src/idents.rs index ad71f47..6486fd8 100644 --- a/src/idents.rs +++ b/src/idents.rs @@ -3,7 +3,7 @@ use std::fmt::Display; use quote::ToTokens; use syn::Ident; -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, Hash)] pub struct ContainerIdent(pub Ident); impl Display for ContainerIdent { @@ -12,66 +12,24 @@ impl Display for ContainerIdent { } } -impl PartialEq for ContainerIdent { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - -impl Eq for ContainerIdent {} - -impl std::hash::Hash for ContainerIdent { - fn hash(&self, state: &mut H) { - self.0.hash(state); - } -} - impl ToTokens for ContainerIdent { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { self.0.to_tokens(tokens); } } -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, Hash)] pub struct VariantIdent(pub Ident); -impl PartialEq for VariantIdent { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - -impl Eq for VariantIdent {} - -impl std::hash::Hash for VariantIdent { - fn hash(&self, state: &mut H) { - self.0.hash(state); - } -} - impl ToTokens for VariantIdent { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { self.0.to_tokens(tokens); } } -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq, Hash)] pub struct FieldIdent(pub Ident); -impl PartialEq for FieldIdent { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } -} - -impl Eq for FieldIdent {} - -impl std::hash::Hash for FieldIdent { - fn hash(&self, state: &mut H) { - self.0.hash(state); - } -} - impl ToTokens for FieldIdent { fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) { self.0.to_tokens(tokens);