From 7da07ff48bee36fabce6a6683eabd27003e32b8d Mon Sep 17 00:00:00 2001 From: "zed.zy" Date: Tue, 15 Mar 2022 19:37:52 +0800 Subject: [PATCH 1/2] Improve the explanation about the behaviour of read_line --- library/std/src/io/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 6005270a75fec..e53e1f4930935 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2110,7 +2110,7 @@ pub trait BufRead: Read { } /// Read all bytes until a newline (the `0xA` byte) is reached, and append - /// them to the provided buffer. + /// them to the provided buffer (without clear buffer before appending to it). /// /// This function will read bytes from the underlying stream until the /// newline delimiter (the `0xA` byte) or EOF is found. Once found, all bytes From 2c06c861de2f9674719cd1e5eac571efc359d8df Mon Sep 17 00:00:00 2001 From: Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> Date: Wed, 16 Mar 2022 03:04:40 +0100 Subject: [PATCH 2/2] changed wording --- library/std/src/io/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index e53e1f4930935..cd2197fca350e 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2110,7 +2110,8 @@ pub trait BufRead: Read { } /// Read all bytes until a newline (the `0xA` byte) is reached, and append - /// them to the provided buffer (without clear buffer before appending to it). + /// them to the provided buffer. You do not need to clear the buffer before + /// appending. /// /// This function will read bytes from the underlying stream until the /// newline delimiter (the `0xA` byte) or EOF is found. Once found, all bytes