diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-11-29 13:10:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-29 13:10:34 +0100 |
| commit | 3ed113cecee0e73552e9142b5bb3c65bef7835cf (patch) | |
| tree | 2a0bf75c4a299fc0f027cad28dd7c42966bccec1 /src/libstd | |
| parent | aebf07e3eb95dbcfa1ff468a6a428e7029c58d41 (diff) | |
| parent | 1ed91951c3012e9aabb403d28b902c56cc143907 (diff) | |
| download | rust-3ed113cecee0e73552e9142b5bb3c65bef7835cf.tar.gz rust-3ed113cecee0e73552e9142b5bb3c65bef7835cf.zip | |
Rollup merge of #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.
Diffstat (limited to 'src/libstd')
| -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)?; /// |
