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
thread 'main' panicked at /home/nano/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-lite-2.6.0/src/io.rs:1909:13:
assertion failed: buf.is_empty()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Although this is a bit of unexpected behavior since read_line from std appends a string.
It is also written in both documentations:
All bytes up to, and including, the newline delimiter (if found) will be appended to buf.
However, nothing is said about you can't use a non-empty string. I think it would be better to repeat std semantic and to append the buffer, at least when it's non empty
The text was updated successfully, but these errors were encountered:
The behavior of the canonical read_line is to append to whatever buffer
is passed into it. At the moment it assumes the buffer is empty and
panics otherwise. This commit adds a check for the buffer being empty,
and appends the string otherwise. This is very inefficient but should be
relatively uncommon.
This commit also adds a unit test to prevent regressions.
Fixes#124
Signed-off-by: John Nunley <[email protected]>
I found some weird behavior of
read_line
It panics in debug on non-empty buffer:
This code prints
Although this is a bit of unexpected behavior since
read_line
from std appends a string.It is also written in both documentations:
However, nothing is said about you can't use a non-empty string. I think it would be better to repeat std semantic and to append the buffer, at least when it's non empty
The text was updated successfully, but these errors were encountered: