about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-11-29 13:10:34 +0100
committerGitHub <noreply@github.com>2018-11-29 13:10:34 +0100
commit3ed113cecee0e73552e9142b5bb3c65bef7835cf (patch)
tree2a0bf75c4a299fc0f027cad28dd7c42966bccec1 /src/libstd
parentaebf07e3eb95dbcfa1ff468a6a428e7029c58d41 (diff)
parent1ed91951c3012e9aabb403d28b902c56cc143907 (diff)
downloadrust-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.rs2
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)?;
 ///