-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Consider reinstating str_to_string and string_to_string #5610
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
Comments
The intentions of those lints were, that
|
There's no performance benefit. But |
Fair point. I think we can re-add these as |
I would like to work on this. From what I can gather from the conversation, I have to add the two lints to the restriction lints. I found the PR #795 which deprecated the lints, but i can't find the lint files itself for both the lints. I also tried looking through git history for any file named str_to_string, but no success. Any way i can find those files, so that i can add them to the restriction lints? |
You won't have much luck finding those files, since the repo was at least restructured 2 times since then. You will have to reimplement those lints. |
I think i am missing something but I can't find any variant for String in |
See rust-clippy/clippy_lints/src/methods/mod.rs Line 1903 in 6b01c39
|
Interesting. I actually thought about this the other way around. i.e. |
Generally I use the inlay type hints in Rust Analyzer to figure that out. You can think of |
The rules
str_to_string
andstring_to_string
have both been removed, so things like"foo".to_string()
can no longer be warned for. I find those warnings very valuable, and have been "manually" linting them in code reviews. In particular, it's useful to distinguish between converting something to a string (relatively rare. deserves special attention in code review) and managing memory so it has the right form (very common, can mostly be glossed over). I think it's reasonable that these hints are off-by-default, and in the pedantic category, but they are certainly something I'd turn on.FWIW, I went through clippy to try and implement the above hints, while is when I found they had previously been implemented and removed.
The text was updated successfully, but these errors were encountered: