We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 499484f commit a21c7b5Copy full SHA for a21c7b5
src/libstd/io/mod.rs
@@ -345,7 +345,11 @@ fn append_to_string<F>(buf: &mut String, f: F) -> Result<usize>
345
fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize> {
346
let start_len = buf.len();
347
let mut len = start_len;
348
- let mut new_write_size = 16;
+ let mut new_write_size = if buf.capacity() > 16 {
349
+ buf.capacity() - buf.len()
350
+ } else {
351
+ 16
352
+ };
353
let ret;
354
loop {
355
if len == buf.len() {
0 commit comments