Description
Hello,
I've read the documentation so I understand that read_line appends into the passed &mut String
argument. I don't understand the use case of that behaviour. To circumvent it, one has to write its own little helper function or not forget to .clear()
or .truncate(0)
before each new call. So read_line
's name doesn't match is behaviour because it reads and appends.
I also looked at the tests 1 and 2 for read_line
and they don't even verify that append
feature because they .truncate(0)
between each check.
Would it be possible to deprecate that behaviour ? If not, would it be possible to document the design intent with a sensible use case, add tests for it and think about an additional simpler interface to load a line into a String
?
Thank you.