fix: correctly parse top-level attribute
This commit is contained in:
parent
4ef0d0230f
commit
8b8953d071
1 changed files with 7 additions and 0 deletions
|
@ -78,6 +78,7 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result<TokenStream> {
|
||||||
// * ident + punct
|
// * ident + punct
|
||||||
// * ident + group + punct
|
// * ident + group + punct
|
||||||
// * ident (the last one)
|
// * ident (the last one)
|
||||||
|
// * ident + group (the last one)
|
||||||
|
|
||||||
let ident: syn::Ident = syn::parse2(token.into_token_stream())?;
|
let ident: syn::Ident = syn::parse2(token.into_token_stream())?;
|
||||||
|
|
||||||
|
@ -104,6 +105,12 @@ fn derive_impl(input: syn::DeriveInput) -> syn::Result<TokenStream> {
|
||||||
};
|
};
|
||||||
|
|
||||||
extra_attrs.push(quote! { #[#ident #group] });
|
extra_attrs.push(quote! { #[#ident #group] });
|
||||||
|
|
||||||
|
// if the second item was group, we may need to consume the next punct
|
||||||
|
// but we may have ran out of tokens at this point
|
||||||
|
if relax_attr_tokens.next().is_none() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let fields = match &input.data {
|
let fields = match &input.data {
|
||||||
|
|
Loading…
Reference in a new issue