-
Notifications
You must be signed in to change notification settings - Fork 173
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
fix(proc macros): generate documentation for trait methods. #453
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one nit.
/// Note that `doc comments` are expanded into `#[doc = "some comment"]` | ||
/// Thus, if the attribute starts with `doc` => it's regarded as a doc comment. | ||
pub(crate) fn extract_doc_comments(attrs: &[syn::Attribute]) -> TokenStream2 { | ||
let docs = attrs.iter().filter(|attr| attr.path.is_ident("doc")).filter(|attr| match attr.parse_meta() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super happy with the formatting of this one but it's better then previous version at least.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have been .filter(|attr| attr.path.is_ident("doc") && match ...
🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥶 I can fix it in an follow up PR
Closing #449
Note, we are not using the docs on the entire trait instead we are manually inserting documentation there but for that we need to parse the
TraitItem
for that so out-of-scope for this PR.To elaborate if you do:
Expands to