Skip to content

Commit 5fc9d68

Browse files
committed
Rollup merge of rust-lang#56124 - antoine-de:fix_read_to_end_doc_mistake, r=TimNN
Fix small doc mistake on std::io::read::read_to_end The std::io::read main documentation can lead to error because the buffer is prefilled with 10 zeros that will pad the response. Using an empty vector is better. The `read_to_end` documentation is already correct though. This is my first rust PR, don't hesitate to tell me if I did something wrong.
2 parents 962e210 + 1ed9195 commit 5fc9d68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/io/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R,
431431
/// // read up to 10 bytes
432432
/// f.read(&mut buffer)?;
433433
///
434-
/// let mut buffer = vec![0; 10];
434+
/// let mut buffer = Vec::new();
435435
/// // read the whole file
436436
/// f.read_to_end(&mut buffer)?;
437437
///

0 commit comments

Comments
 (0)