You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please consider renaming string::push_str() to string::concat(). Push_X() in the context of a collection means X will be added to the container as a single entity. Hence push_str() is meaningless for strings since a string can only contain characters (char != [char]).
If it is too late to rename then consider adding a method called concat() anyway.
Also consider renaming Vec::push_all() to Vec::concat() so that the name is consistent with String::concat().
The text was updated successfully, but these errors were encountered:
@SDX2000: Thanks for this! This would be probably more appropriate as a comment on the current collections reform RFC, so I'm going to close this and redirect you to comment there. Generally speaking though, we already have a function concat, so we do have some desire to not use the same name for different things. Instead, a better solution might be if we end up growing an AddAssign trait that we could instead write:
letmut v = String::new();
v += 'a';
v += "foo";letmut v = Vec::new();
v += 1u8;
v += [2u8,3,4];
And not worry about the method. There is a chance we might be able to get this in for rust 1.0 if someone does the work :)
Please consider renaming string::push_str() to string::concat(). Push_X() in the context of a collection means X will be added to the container as a single entity. Hence push_str() is meaningless for strings since a string can only contain characters (char != [char]).
If it is too late to rename then consider adding a method called concat() anyway.
Also consider renaming Vec::push_all() to Vec::concat() so that the name is consistent with String::concat().
The text was updated successfully, but these errors were encountered: