Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a panic caused by unwrapping an option #105

Merged
merged 2 commits into from
Aug 6, 2020

Conversation

Peternator7
Copy link
Owner

No description provided.

@Peternator7 Peternator7 merged commit 3299622 into master Aug 6, 2020
@@ -11,7 +11,7 @@ fn get_metadata_inner<'a>(
it: impl IntoIterator<Item = &'a syn::Attribute>,
) -> Vec<syn::Meta> {
it.into_iter()
.map(|attr| attr.parse_meta().unwrap())
.filter_map(|attr| attr.parse_meta().ok())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this is still wrong. This will now silently ignore malformed strum attributes. Instead, you should filter by attr.path.is_ident(ident) and then use parse_meta() without discarding errors (the is_ident check below can then be skipped).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also recommend setting up trybuild to test expected proc-macro errors.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to take a PR fixing this. Historically strum ignored improperly formatted/tagged attributes. Version 0.19 took some steps in the right direction in terms of failing on bad inputs, but not all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants