-
Notifications
You must be signed in to change notification settings - Fork 746
143 comment get tag attr #158
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
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.
Looks good to me with those changes, thanks!
@@ -134,20 +134,23 @@ impl Annotations { | |||
if comment.kind() == CXComment_HTMLStartTag && | |||
comment.get_tag_name() == "div" && | |||
comment.get_num_tag_attrs() > 1 && | |||
comment.get_tag_attr_name(0) == "rustbindgen" { | |||
comment.get_tag_attr_name(0) == Some("rustbindgen".to_string()) { |
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.
comment.get_tag_attr_name(0).as_ref() == Some("rustbindgen")
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.
Good catch, thank you! I had to use as_ref().map(|s| s.as_str())
to prevent the compiler from complaining about seeing &String
and expecting &'static str
.
=> self.accessor_kind = Some(parse_accessor(&value)), | ||
_ => {}, | ||
let name_opt = comment.get_tag_attr_name(i); | ||
match name_opt { |
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.
We can use match comment.get_tag_attr_name(i).unwrap().as_str()
, since we know we're inside the bounds.
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.
Done!
Also, you seem to have two commits with the same message, feel free to squash them if you wish, thanks! |
@bors-servo r+ Thanks! |
📌 Commit 6298736 has been approved by |
143 comment get tag attr Fixes #143
💔 Test failed - status-travis |
unsafe { | ||
String_ { x: clang_HTMLStartTag_getAttrValue(self.x, idx) }.to_string() | ||
pub fn get_tag_attr_value(&self, idx: c_uint) -> Option<String> { | ||
if idx < self.get_num_tag_attrs() { |
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 wrong, the check should be in the other direction (if idx < num { Some(..) }
). Same everywhere else.
@bors-servo r+ Thanks again :) |
📌 Commit 11f0839 has been approved by |
⚡ Test exempted - status |
143 comment get tag attr Fixes #143
Thank you! |
Fixes #143