Skip to content

Commit

Permalink
ignore attributes that arent ours
Browse files Browse the repository at this point in the history
  • Loading branch information
jewlexx committed Dec 11, 2024
1 parent 0b5e952 commit 001a3fd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions quork-proc/src/strip_enum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use proc_macro2::{Ident, TokenStream};
use proc_macro_error2::{abort, abort_call_site};
use quote::{quote, ToTokens};
use syn::{spanned::Spanned, DeriveInput, Meta, Variant, Visibility};
use syn::{spanned::Spanned, DeriveInput, Meta, MetaList, MetaNameValue, Variant, Visibility};

fn ignore_variant(variant: &Variant) -> bool {
variant.attrs.iter().any(|attr| match attr.meta {
Expand All @@ -27,10 +27,17 @@ fn ignore_variant(variant: &Variant) -> bool {

ignored
}
_ => abort!(
attr.span(),
"Expected list-style (i.e #[stripped(...)]), found other style attribute macro"
),
Meta::Path(ref path)
| Meta::List(MetaList { ref path, .. })
| Meta::NameValue(MetaNameValue { ref path, .. })
if path.is_ident("stripped") =>
{
abort!(
attr.span(),
"Expected list-style (i.e #[stripped(...)]), found other style attribute macro"
);
}
_ => false,
})
}

Expand Down

0 comments on commit 001a3fd

Please sign in to comment.