-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add impl From<&String> for String #59827
Comments
that could hide unnecessary clone |
This is functionally identical to the existing The clone would be necessary - if the receiving function needs to own the |
Do you have an example why this is useful? |
@hellow554 > No it doesn't, but it
Currently the nicest way to handle this is |
Okay, that's true. But you will have the same issue with |
To quote me: #59825 (comment) |
string: implement From<&String> for String Allow Strings to be created from borrowed Strings. This is mostly to make things like passing `&String` to an `impl Into<String>` parameter frictionless. Fixes rust-lang#59827.
string: implement From<&String> for String Allow Strings to be created from borrowed Strings. This is mostly to make things like passing `&String` to an `impl Into<String>` parameter frictionless. Fixes rust-lang#59827.
string: implement From<&String> for String Allow Strings to be created from borrowed Strings. This is mostly to make things like passing `&String` to an `impl Into<String>` parameter frictionless. Fixes rust-lang#59827.
If a function takes
impl Into<String>
it would be nice to pass it a&String
(say, from pattern matching) without additional friction.#59825 implements this.
The text was updated successfully, but these errors were encountered: