Skip to content

Features/nerf unused string fns #14414

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

Closed
wants to merge 4 commits into from

Conversation

richo
Copy link
Contributor

@richo richo commented May 25, 2014

This should block on #14323

@huonw
Copy link
Member

huonw commented May 25, 2014

Thanks for doing this.

The .to_owned method can also be removed and replaced by .to_strbuf... which should really be renamed to .to_string.

@richo
Copy link
Contributor Author

richo commented May 25, 2014

Yup, thats my plan. I'll get it together tonight.
On 24/05/2014 10:24 pm, "Huon Wilson" notifications@github.com wrote:

Thanks for doing this.

The .to_owned method can also be removed and replaced by .to_strbuf...
which should really be renamed to .to_string.


Reply to this email directly or view it on GitHubhttps://github.com//pull/14414#issuecomment-44112988
.

@richo
Copy link
Contributor Author

richo commented May 25, 2014

ok, so I'm making good progress on this, however just as FUD that seems worth raising, having to do

"foobar".to_string()

everywhere seems weird and confusing. We should look seriously at how to fix this.

@richo
Copy link
Contributor Author

richo commented May 25, 2014

ok, patches updated. Ignore the commits, if the diff looks OK I'll rebase them into something mergable.

@huonw
Copy link
Member

huonw commented May 25, 2014

Seems ok, but yeah, maybe it would be nice to have a few more opinions on the .to_string name.

@alexcrichton
Copy link
Member

I also think that we need to reconcile the to_str method from the ToStr trait with the to_string method for getting an instance of String.

I believe that the name to_string is appropriate because in rust a string literal will be a "str" and the concept of a String is different. That's what we bought into with the names we chose.

@emberian
Copy link
Member

I don't see why to_str wouldn't be the way you get a String, and we could name it to_string.

@richo
Copy link
Contributor Author

richo commented May 25, 2014

OK, this is enough to be actionable. Its going to be another monstrous pain
to get merged I suspect so thanks in advance for bearing with me :)
On 25/05/2014 1:36 pm, "Corey Richardson" notifications@github.com wrote:

I don't see why to_str wouldn't be the way you get a String, and we could
name it to_string.


Reply to this email directly or view it on GitHubhttps://github.com//pull/14414#issuecomment-44144851
.

@huonw
Copy link
Member

huonw commented May 26, 2014

BTW, any removed functions/methods should be not removed right now, but marked with #[deprecated = "use ...], as described here.

The stdlibs should still be updated to avoid the old functions, but keeping a dummy implementation like the following is good:

#[deprecated = "use `.to_string`"]
fn to_owned(&self) -> String { self.to_string() }

(This includes from_owned_str etc.)

@richo
Copy link
Contributor Author

richo commented May 26, 2014

I think this should be good to go now.

I rebased on master, and deprecated instead of removing those string functions.

@huonw
Copy link
Member

huonw commented May 27, 2014

The travis failure is relevant.

@richo
Copy link
Contributor Author

richo commented May 27, 2014

Yup, fixed some but not all (I botched the rebase)

Will ping when its green
On 26/05/2014 11:38 pm, "Huon Wilson" notifications@github.com wrote:

The travis failure is relevant.


Reply to this email directly or view it on GitHubhttps://github.com//pull/14414#issuecomment-44240278
.

@richo
Copy link
Contributor Author

richo commented May 27, 2014

This includes a bunch of places where to_string is actually called on a String, I'm going to treat this as an excuse to play with static analysis a little more to detect these cases, however I tend to this that this should be merged asap (When the build gets green) because rebasing this on master all the time is painful.

@richo
Copy link
Contributor Author

richo commented May 27, 2014

make check-stage1 NO_REBUILD=1 NO_BENCH=1 just passed locally for me. Just waiting on Travis.

@richo
Copy link
Contributor Author

richo commented May 27, 2014

confirmed tests pass locally. r?

bors added a commit that referenced this pull request May 28, 2014
@bors bors closed this May 28, 2014
flip1995 added a commit to flip1995/rust that referenced this pull request Apr 3, 2025
Fix missing comment annotations in the clippy book

changelog: none
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.

5 participants