about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2016-06-28 16:05:16 +0200
committerGitHub <noreply@github.com>2016-06-28 16:05:16 +0200
commitf47fcc738b49d9dcd3527a4031c101b249c93a03 (patch)
tree6494c0d5537fdaf04cf2c8c21786f7d8def42d1c /src/libstd
parent890e3a7a1a521ced5502645ee774f7db995cf72c (diff)
parenta350ca62cdf2ee7cc11ff2c03bd6bb27e0db7024 (diff)
downloadrust-f47fcc738b49d9dcd3527a4031c101b249c93a03.tar.gz
rust-f47fcc738b49d9dcd3527a4031c101b249c93a03.zip
Rollup merge of #34517 - frewsxcv:empty, r=GuillaumeGomez
Minor rewrite of `std::io::empty` doc example.

None
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/util.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs
index 2815c0163d6..c18315c4947 100644
--- a/src/libstd/io/util.rs
+++ b/src/libstd/io/util.rs
@@ -78,14 +78,11 @@ pub struct Empty { _priv: () }
 /// A slightly sad example of not reading anything into a buffer:
 ///
 /// ```
-/// use std::io;
-/// use std::io::Read;
+/// use std::io::{self, Read};
 ///
-/// # fn foo() -> io::Result<String> {
 /// let mut buffer = String::new();
-/// try!(io::empty().read_to_string(&mut buffer));
-/// # Ok(buffer)
-/// # }
+/// io::empty().read_to_string(&mut buffer).unwrap();
+/// assert!(buffer.is_empty());
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
 pub fn empty() -> Empty { Empty { _priv: () } }