-
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
IDE Assist for &str
-> String
#11383
Comments
An assist for a trivial(and very specific task) like this seems unlikely to be of much value. This sounds more like the task for a custom completion snippet: "rust-analyzer.completion.snippets": {
"String::from": {
"postfix": "strfrom",
"body": "String::from(${receiver})",
"scope": "expr",
},
}, On the other hand, we should already show a |
Slightly disagree, once we have a diagnostic saying "this expects a String, but got a &str", then it makes sense to give a quickfix for that. |
Yes of course, I was solely thinking of assists, not diagnostic quickfixes. Having a diagnostic quickfix here certainly makes sense. |
This is doable now that we have the |
2022-04-28.20.57.18.movI found out that this feature already exists. |
That's a quickfix coming from rustc, not rust-analyzer. |
@rustbot claim |
Hello, rust analyzer maintainers! It would be awesome to have an IDE assist feature in which a user could convert a
&str
to aString
by essentially just wrapping it inString::from()
(or.to_string()
, whatever would be best). I would be interested in adding myself if it ends up getting accepted by the RA team.The text was updated successfully, but these errors were encountered: