diff options
| author | antoine-de <antoine.desbordes@gmail.com> | 2018-11-21 11:17:48 +0100 |
|---|---|---|
| committer | antoine-de <antoine.desbordes@gmail.com> | 2018-11-21 11:17:48 +0100 |
| commit | 1ed91951c3012e9aabb403d28b902c56cc143907 (patch) | |
| tree | c2dca740f26058da2ecad607b3c3d77a5f7ba103 /src | |
| parent | 780658a464603fa755d94b27f72a375bd81d07ea (diff) | |
| download | rust-1ed91951c3012e9aabb403d28b902c56cc143907.tar.gz rust-1ed91951c3012e9aabb403d28b902c56cc143907.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libstd/io/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index e263db24fc2..076524e624a 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -431,7 +431,7 @@ fn read_to_end_with_reservation<R: Read + ?Sized>(r: &mut R, /// // read up to 10 bytes /// f.read(&mut buffer)?; /// -/// let mut buffer = vec![0; 10]; +/// let mut buffer = Vec::new(); /// // read the whole file /// f.read_to_end(&mut buffer)?; /// |
