-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
new lint for &str to String conversion #2824
Comments
I think we can rule out the So we're left with
Statistics on the crate seem like a good idea, but might end up being expensive (you need to first go through the entire crate looking at all method/function calls, collect the stats, and then run the lint normally). So we'll need to benchmark some large crates and see how expensive it is in reality. |
Honestly, I'd rule out |
I remember @steveklabnik having opinions on this |
The official style is to use ( |
|
I have to disagree. It's not much of a difference, but |
@spunit262 exactly, lex foo = "foo".to_string(); "WTF, isn't it a string already?" It's actually the other way around: use @clarfonthey I think |
There are a few different ways to convert from a
&str
to aString
:Without going into a discussion about which is the best (this lint has been deprecated), I think a lint to ensure the same one is used throughout a crate would be interesting.
This could be done either through configuration, or by keeping stats on which is used and then emit warning for the non majority one.
I can work on it, but wanted to have a general point of view before. What do you think ?
The text was updated successfully, but these errors were encountered: