From 7831f6f1f7c7dddce1308738bd6d9ff654f71274 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Sat, 28 Oct 2023 18:35:32 -0400 Subject: [PATCH] Impl Copy, Eq, and FusedIterator for EnumIter iterators --- strum_macros/src/macros/enum_iter.rs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/strum_macros/src/macros/enum_iter.rs b/strum_macros/src/macros/enum_iter.rs index 0e700aa0..84974042 100644 --- a/strum_macros/src/macros/enum_iter.rs +++ b/strum_macros/src/macros/enum_iter.rs @@ -71,9 +71,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { 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 { } } - 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 { } }) }