-
Notifications
You must be signed in to change notification settings - Fork 747
Add Builder::clang_args (plural) #636
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.
r=me with those if possible, thanks!
src/lib.rs
Outdated
@@ -555,6 +555,15 @@ impl Builder { | |||
self | |||
} | |||
|
|||
/// Add arguments to be passed straight through to clang. | |||
pub fn clang_args<I>(mut self, iter: I) -> Builder | |||
where I: IntoIterator, I::Item: AsRef<str> { |
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.
Can we use the format specified in rustfmt.toml
?
That is:
pub fn clang_args<I>(mut self, iter: I) -> Builder
where I: IntoIterator,
I::Item: AsRef<str>,
{
// ...
}
src/lib.rs
Outdated
pub fn clang_args<I>(mut self, iter: I) -> Builder | ||
where I: IntoIterator, I::Item: AsRef<str> { | ||
for arg in iter { | ||
self.options.clang_args.push(arg.as_ref().into()); |
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.
perhaps:
self = self.clang_arg(arg.as_ref());
(not sure if you can assing to self, but perhaps using an intermediate variable is an option?)
That way if we add more stuff to clang_arg
we can just keep this. Not a big deal if it's annoying for some reason.
Oh, also, you need to update the cargo.lock so travis is happy. |
Use AsRef<str> rather than Into<String> because &&str (what you get when iterating &[&str]) does not implement the latter.
☔ The latest upstream changes (presumably c5e044d) made this pull request unmergeable. Please resolve the merge conflicts. |
Done both. I was also skeptical about assigning to @bors-servo r=emilio |
📌 Commit c5e044d has been approved by |
Add Builder::clang_args (plural) Use `AsRef<str>` rather than `Into<String>` because `&&str` (what you get when iterating `&[&str]`) does not implement the latter.
☀️ Test successful - status-travis |
Use
AsRef<str>
rather thanInto<String>
because&&str
(what you get when iterating&[&str]
) does not implement the latter.