If I have a String, and I want to reuse it, currently I do
// s is a mut String
Is this the best/most efficient way to do it? I also looked at
s.truncate() is incorrect, it should say
is what I’d use.
replace_range is more flexible but I’d expect it to run slower than the above.
This looks like the exact use case of
clone_into(). Unfortunately, people aren’t happy with the way this method looks and it’ll need a champion to get stabilized.