str::to_string -> str::to_owned#1734
Conversation
coolreader18
left a comment
There was a problem hiding this comment.
I prefer this version, I'm not sure what others' thoughts are though.
|
@youknowone could you explain a bit what your motivation is for this specific change? Reading this blog post, it looks like there is no difference in the two methods. |
|
There is a reddit link in the post you linked and I think this is my reason: https://www.reddit.com/r/rust/comments/4l71qw/how_do_i_convert_a_str_to_string_the_beginning_in/d3l23vf/ Derived pros: For most of this call, we just want to create String from &str. But, because .to_string() is defined to Display trait, we accidently can put a ToString object instead of &str object - which is not mostly intended. For Probably This is a kind of human engineering. Here is another PR I made with similar motivation. #1654 |
|
@youknowone thank you for your detailed explanation! |
please reject this PR if it is out of our preference or rust community convention.