1
0
mirror of https://github.com/danog/strum.git synced 2024-11-26 12:04:38 +01:00

Impl Copy, Eq, and FusedIterator for EnumIter iterators

This commit is contained in:
John T. Wodder II 2023-10-28 18:35:32 -04:00
parent 597f8e941f
commit 7831f6f1f7

View File

@ -71,9 +71,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
Ok(quote! {
#[doc = #doc_comment]
#[allow(
missing_copy_implementations,
)]
#[derive(Clone, Copy, Eq, PartialEq)]
#vis struct #iter_name #ty_generics {
idx: usize,
back_idx: usize,
@ -159,14 +157,6 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
}
}
impl #impl_generics Clone for #iter_name #ty_generics #where_clause {
fn clone(&self) -> #iter_name #ty_generics {
#iter_name {
idx: self.idx,
back_idx: self.back_idx,
marker: self.marker.clone(),
}
}
}
impl #impl_generics ::core::iter::FusedIterator for #iter_name #ty_generics #where_clause { }
})
}