diff --git a/crates/teloxide-macros/src/attr.rs b/crates/teloxide-macros/src/attr.rs index 64be81a0..cbcee8ac 100644 --- a/crates/teloxide-macros/src/attr.rs +++ b/crates/teloxide-macros/src/attr.rs @@ -8,20 +8,21 @@ use syn::{ }; pub(crate) fn fold_attrs( - attrs: impl Iterator, + attrs: &[Attribute], filter: fn(&Attribute) -> bool, parse: impl Fn(Attr) -> Result, init: A, f: impl Fn(A, R) -> Result, ) -> Result { attrs - .filter(filter) + .iter() + .filter(|&a| filter(a)) .flat_map(|attribute| { let Some(key) = attribute.path.get_ident().cloned() else { return vec![Err(compile_error_at("expected an ident", attribute.path.span()))] }; match (|input: ParseStream<'_>| Attrs::parse_with_key(input, key)) - .parse(attribute.tokens.into()) + .parse(attribute.tokens.clone().into()) { Ok(ok) => ok.0.into_iter().map(&parse).collect(), Err(err) => vec![Err(err.into())], diff --git a/crates/teloxide-macros/src/command_attr.rs b/crates/teloxide-macros/src/command_attr.rs index 3e7a6592..b9ce1727 100644 --- a/crates/teloxide-macros/src/command_attr.rs +++ b/crates/teloxide-macros/src/command_attr.rs @@ -56,7 +56,7 @@ impl CommandAttrs { use CommandAttrKind::*; fold_attrs( - attributes.iter().cloned(), + attributes, |attr| is_command_attribute(attr) || is_doc_comment(attr), CommandAttr::parse, Self {