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

Tidy bridge converter #10

Merged
merged 2 commits into from Oct 9, 2020
Merged

Tidy bridge converter #10

merged 2 commits into from Oct 9, 2020

Conversation

adetaylor
Copy link
Collaborator

A bit of code tidying.

@adetaylor adetaylor merged commit 905328f into main Oct 9, 2020
Comment on lines +284 to +294
ItemForeignMod {
attrs: Vec::new(),
abi: syn::Abi {
extern_token: Token![extern](Span::call_site()),
name: Some(syn::LitStr::new("C", Span::call_site())),
},
brace_token: syn::token::Brace {
span: Span::call_site(),
},
items: Vec::new(),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

These syntax tree nodes are not really designed to be instantiated other than by a parser. syn::parse_quote would be a good fit here:

Suggested change
ItemForeignMod {
attrs: Vec::new(),
abi: syn::Abi {
extern_token: Token![extern](Span::call_site()),
name: Some(syn::LitStr::new("C", Span::call_site())),
},
brace_token: syn::token::Brace {
span: Span::call_site(),
},
items: Vec::new(),
}
parse_quote!(extern "C" {})

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks - over time I'll gradually address this and replace them all with parse_quote. Filed #12 to remind me.

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.

None yet

2 participants