blob: 39957df2b5c31e0f8879a414b470078e6e7fd43a [file] [log] [blame]
use crate::ARBITRARY_ATTRIBUTE_NAME;
use syn::*;
pub fn not_skipped(variant: &&Variant) -> bool {
!should_skip(variant)
}
fn should_skip(Variant { attrs, .. }: &Variant) -> bool {
attrs
.iter()
.filter_map(|attr| {
attr.path()
.is_ident(ARBITRARY_ATTRIBUTE_NAME)
.then(|| attr.parse_args::<Meta>())
.and_then(Result::ok)
})
.any(|meta| match meta {
Meta::Path(path) => path.is_ident("skip"),
_ => false,
})
}