From 47ad84c17ed536a061646b8bb7707ad23faf167d Mon Sep 17 00:00:00 2001 From: TheAwiteb Date: Thu, 2 Mar 2023 15:04:59 +0300 Subject: [PATCH] Make `attrs` in `fold_attrs` expect Iterator of `Attribute` instead of `&[Attribute]` --- crates/teloxide-macros/src/attr.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/teloxide-macros/src/attr.rs b/crates/teloxide-macros/src/attr.rs index a52aff01..f8e2e521 100644 --- a/crates/teloxide-macros/src/attr.rs +++ b/crates/teloxide-macros/src/attr.rs @@ -7,15 +7,14 @@ use syn::{ Attribute, Ident, Lit, Path, Token, }; -pub(crate) fn fold_attrs( - attrs: &[Attribute], +pub(crate) fn fold_attrs<'a, A, R>( + attrs: impl Iterator, filter: fn(&Attribute) -> bool, parse: impl Fn(Attr) -> Result, init: A, f: impl Fn(A, R) -> Result, ) -> Result { attrs - .iter() .filter(|&a| filter(a)) .flat_map(|attribute| { // FIXME: don't allocate here