-
Notifications
You must be signed in to change notification settings - Fork 698
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
codegen: Add an option to skip comment generation. #444
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.
r=me with nitpicks addressed
Thanks!
@@ -1007,8 +1011,10 @@ impl CodeGenerator for CompInfo { | |||
}; | |||
|
|||
let mut attrs = vec![]; | |||
if let Some(comment) = field.comment() { | |||
attrs.push(attributes::doc(comment)); | |||
if ctx.options().generate_comments { |
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.
This is a whole lot of copy paste... What if we made Item::comment
and Field::comment
take the context and check themselves? The earlier we push this check, we could even potentially avoid keeping the comments around in memory.
I would be fine with landing this code now and investigating this later, but if you do want to land the code now, please file an issue and maybe mark it as a good first bug to attract new contributors.
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.
That's right, but I thought that the alternative would be less readable? Anyway, will file.
@@ -1,6 +1,6 @@ | |||
[root] | |||
name = "bindgen" | |||
version = "0.20.2" | |||
version = "0.20.3" |
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.
This should ideally be part of the previous commit.
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.
Right, moved.
/// Whether to whitelist types recursively or not. Defaults to true. | ||
/// | ||
/// See https://github.com/servo/rust-bindgen/issues/429 for different use | ||
/// cases for this. |
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 think we should elaborate the use cases here: one shouldn't have to jump from the rustdocs to a random github issue to understand why a method exists and to figure out if they should use it or not.
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.
Fair enough :)
This is mostly a work around rust-lang#426, until we implement the proper fix.
@bors-servo r=fitzgen |
📌 Commit 78e425f has been approved by |
☀️ Test successful - status-travis |
This is much appreciated. Thanks! |
This is mostly a work around #426,
until we implement the proper fix.
r? @fitzgen