Fix fold_attrs format

This commit is contained in:
TheAwiteb 2023-09-20 18:18:05 +03:00
parent 7c7f58dffb
commit f979cc4f26
No known key found for this signature in database
GPG key ID: ABF818BD15DC2D34

View file

@ -15,11 +15,15 @@ pub(crate) fn fold_attrs<A, R>(
f: impl Fn(A, R) -> Result<A>, f: impl Fn(A, R) -> Result<A>,
) -> Result<A> { ) -> Result<A> {
attrs attrs
.iter() .iter()
.filter(|&a| filter(a)) .filter(|&a| filter(a))
.flat_map(|attribute| { .flat_map(|attribute| {
let Some(key) = attribute.path.get_ident().cloned() let Some(key) = attribute.path.get_ident().cloned() else {
else { return vec![Err(compile_error_at("expected an ident", attribute.path.span()))] }; return vec![Err(compile_error_at(
"expected an ident",
attribute.path.span(),
))];
};
match (|input: ParseStream<'_>| Attrs::parse_with_key(input, key)) match (|input: ParseStream<'_>| Attrs::parse_with_key(input, key))
.parse(attribute.tokens.clone().into()) .parse(attribute.tokens.clone().into())