Add `FromIterator` implementations for `Cow<str>` #35064

Merged
merged 1 commit into from Aug 9, 2016

Conversation

Projects
None yet
7 participants
@pthariensflame
Contributor

pthariensflame commented Jul 27, 2016

This seems like an oversight, since the corresponding implementation for Cow<[T]> where T: Clone exists.

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Jul 27, 2016

Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

Collaborator

rust-highfive commented Jul 27, 2016

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @aturon (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rphmeier

This comment has been minimized.

Show comment
Hide comment
@rphmeier

rphmeier Jul 27, 2016

Contributor

Would be nice to have an impl<'a, T: 'a, U> FromIterator<U> for Cow<'a, T> where T: ToOwned, T::Owned: FromIterator<U>

but I guess the ship has sailed on that already

Contributor

rphmeier commented Jul 27, 2016

Would be nice to have an impl<'a, T: 'a, U> FromIterator<U> for Cow<'a, T> where T: ToOwned, T::Owned: FromIterator<U>

but I guess the ship has sailed on that already

@alexcrichton alexcrichton added the T-libs label Jul 27, 2016

@pthariensflame

This comment has been minimized.

Show comment
Hide comment
@pthariensflame

pthariensflame Jul 27, 2016

Contributor

@rphmeier Wouldn't that be a strict generalization of every current FromIterator impl for Cow? If everyone wants me to, I could do that instead, and just replace the existing impls with the new unified one.

Contributor

pthariensflame commented Jul 27, 2016

@rphmeier Wouldn't that be a strict generalization of every current FromIterator impl for Cow? If everyone wants me to, I could do that instead, and just replace the existing impls with the new unified one.

src/libcollections/borrow.rs
@@ -274,3 +274,13 @@ impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
self
}
}
+
+// // Generic implementation mentioned in

This comment has been minimized.

@sfackler

sfackler Aug 5, 2016

Member

Could we get rid of this dead code?

@sfackler

sfackler Aug 5, 2016

Member

Could we get rid of this dead code?

This comment has been minimized.

@pthariensflame

pthariensflame Aug 5, 2016

Contributor

I had included it because of @rphmeier's earlier comment, but I can remove it again.

@pthariensflame

pthariensflame Aug 5, 2016

Contributor

I had included it because of @rphmeier's earlier comment, but I can remove it again.

@sfackler

This comment has been minimized.

Show comment
Hide comment
@sfackler

sfackler Aug 5, 2016

Member

Could you remove the commented out implementation and squash down to one commit? We should be good to merge once that happens.

Member

sfackler commented Aug 5, 2016

Could you remove the commented out implementation and squash down to one commit? We should be good to merge once that happens.

@pthariensflame

This comment has been minimized.

Show comment
Hide comment
Contributor

pthariensflame commented Aug 5, 2016

@sfackler Done!

@pthariensflame

This comment has been minimized.

Show comment
Hide comment
@pthariensflame

pthariensflame Aug 7, 2016

Contributor

@sfackler Any word?

Contributor

pthariensflame commented Aug 7, 2016

@sfackler Any word?

Add `FromIterator` implementations for `Cow<str>`
This seems like an oversight, since the corresponding implementation for `Cow<[T]> where T: Clone` exists.
@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Aug 8, 2016

Member

Discussed at libs traige this this past week the decision was to merge, thanks for the PR @pthariensflame!

@bors: r+ 42e64bc

Member

alexcrichton commented Aug 8, 2016

Discussed at libs traige this this past week the decision was to merge, thanks for the PR @pthariensflame!

@bors: r+ 42e64bc

@pthariensflame

This comment has been minimized.

Show comment
Hide comment
Contributor

pthariensflame commented Aug 8, 2016

@alexcrichton Thanks!

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Aug 8, 2016

Contributor

⌛️ Testing commit 42e64bc with merge 080e0e0...

Contributor

bors commented Aug 8, 2016

⌛️ Testing commit 42e64bc with merge 080e0e0...

bors added a commit that referenced this pull request Aug 8, 2016

Auto merge of #35064 - pthariensflame:feature/cow_str_from_iter, r=al…
…excrichton

Add `FromIterator` implementations for `Cow<str>`

This seems like an oversight, since the corresponding implementation for `Cow<[T]> where T: Clone` exists.

@bors bors merged commit 42e64bc into rust-lang:master Aug 9, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@pthariensflame pthariensflame deleted the pthariensflame:feature/cow_str_from_iter branch Aug 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment