From c67ad8bcd81f42b436f3e3aed7bc87ab1d9964a6 Mon Sep 17 00:00:00 2001 From: cAttte <26514199+cAttte@users.noreply.github.com> Date: Sun, 3 Nov 2024 10:24:27 -0300 Subject: [PATCH] fix(macros): enumerate after filtering --- specta-macros/src/type/enum.rs | 8 ++++---- specta-macros/src/type/struct.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/specta-macros/src/type/enum.rs b/specta-macros/src/type/enum.rs index 2698f01..126d95d 100644 --- a/specta-macros/src/type/enum.rs +++ b/specta-macros/src/type/enum.rs @@ -23,11 +23,11 @@ pub fn parse_enum( let generic_idents = generics .params .iter() - .enumerate() - .filter_map(|(i, p)| match p { - GenericParam::Type(t) => Some((i, &t.ident)), + .filter_map(|p| match p { + GenericParam::Type(t) => Some(&t.ident), _ => None, - }); + }) + .enumerate(); let definition_generics = generic_idents.clone().map(|(_, ident)| { let ident = ident.to_string(); diff --git a/specta-macros/src/type/struct.rs b/specta-macros/src/type/struct.rs index 7ad84cc..b612768 100644 --- a/specta-macros/src/type/struct.rs +++ b/specta-macros/src/type/struct.rs @@ -46,11 +46,11 @@ pub fn parse_struct( let generic_idents = generics .params .iter() - .enumerate() - .filter_map(|(i, p)| match p { - GenericParam::Type(t) => Some((i, &t.ident)), + .filter_map(|p| match p { + GenericParam::Type(t) => Some(&t.ident), _ => None, }) + .enumerate() .collect::>(); let reference_generics = generic_idents.iter().map(|(i, ident)| {