Skip to content

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

Merged
merged 1 commit into from
Apr 17, 2017
Merged

Add Builder::clang_args (plural) #636

merged 1 commit into from
Apr 17, 2017

Conversation

SimonSapin
Copy link
Contributor

Use AsRef<str> rather than Into<String> because &&str (what you get when iterating &[&str]) does not implement the latter.

Copy link
Contributor

@emilio emilio left a 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> {
Copy link
Contributor

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());
Copy link
Contributor

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.

@emilio
Copy link
Contributor

emilio commented Apr 17, 2017

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.
@bors-servo
Copy link

☔ The latest upstream changes (presumably c5e044d) made this pull request unmergeable. Please resolve the merge conflicts.

@SimonSapin
Copy link
Contributor Author

Done both. I was also skeptical about assigning to self, but that turns out ok.

@bors-servo r=emilio

@bors-servo
Copy link

📌 Commit c5e044d has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit c5e044d with merge 719d03c...

bors-servo pushed a commit that referenced this pull request Apr 17, 2017
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.
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: emilio
Pushing 719d03c to master...

@bors-servo bors-servo merged commit c5e044d into master Apr 17, 2017
@SimonSapin SimonSapin deleted the clang_args branch April 17, 2017 13:08
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.

4 participants