1
0
mirror of https://github.com/danog/strum.git synced 2024-11-26 20:14:40 +01:00

Raise an error un malformed strum attributes (#119)

This commit is contained in:
Jonas Platte 2020-09-29 19:01:29 +02:00 committed by GitHub
parent 1d2778842b
commit 7e64a470b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,8 @@ fn get_metadata_inner<'a>(
it: impl IntoIterator<Item = &'a syn::Attribute>,
) -> Vec<syn::Meta> {
it.into_iter()
.filter_map(|attr| attr.parse_meta().ok())
.filter(|attr| attr.path.is_ident(ident))
.map(|attr| attr.parse_meta().unwrap())
.filter_map(|meta| match meta {
syn::Meta::List(syn::MetaList { path, nested, .. }) => {
if path.is_ident(ident) {