Skip to content

Commit 1ed9195

Browse files
committed
fix small doc mistake
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.
1 parent 780658a commit 1ed9195

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/io/mod.rs

Lines changed: 1 addition & 1 deletion
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)