Skip to content
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

std: Add ToString trait specialization for Cow<'a, str> and String #39440

Merged
merged 1 commit into from
Feb 4, 2017
Merged

std: Add ToString trait specialization for Cow<'a, str> and String #39440

merged 1 commit into from
Feb 4, 2017

Conversation

F001
Copy link
Contributor

@F001 F001 commented Feb 1, 2017

There is a specialized version of ToString for str type in std. I think there are other types can also benefit from specialization. Cow and String are the most obvious one.

r? @bluss

@bluss
Copy link
Member

bluss commented Feb 1, 2017

Small quibble, but can't we do this one as just self[..].to_owned()? That way there's no duplication of the big allocate+copy code.

There's another subtle case that might benefit, impl ToString for String 😉

@bluss
Copy link
Member

bluss commented Feb 1, 2017

Can you squash this into one commit, and then update pr title and description to match the new content?

A reviewer can use r=me when that is done. Thanks

@F001
Copy link
Contributor Author

F001 commented Feb 1, 2017

Thank you for your patient guidance.

r? @bluss

@F001 F001 changed the title std: Add ToString trait specialization for Cow<'a, str> std: Add ToString trait specialization for Cow<'a, str> and String Feb 1, 2017
@bluss
Copy link
Member

bluss commented Feb 1, 2017

@bors r+

thanks!

@bors
Copy link
Contributor

bors commented Feb 1, 2017

📌 Commit dfcca54 has been approved by bluss

@bors
Copy link
Contributor

bors commented Feb 4, 2017

⌛ Testing commit dfcca54 with merge 8568fdc...

bors added a commit that referenced this pull request Feb 4, 2017
std: Add ToString trait specialization for Cow<'a, str> and String

There is a specialized version of ToString for str type in std. I think there are other types can also benefit from specialization. `Cow` and `String` are the most obvious one.

r? @bluss
@bors
Copy link
Contributor

bors commented Feb 4, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: bluss
Pushing 8568fdc to master...

@bors bors merged commit dfcca54 into rust-lang:master Feb 4, 2017
@F001 F001 deleted the SpecializeCow branch May 12, 2017 03:11
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.

3 participants