Skip to content

Commit f47fcc7

Browse files
Rollup merge of #34517 - frewsxcv:empty, r=GuillaumeGomez
Minor rewrite of `std::io::empty` doc example. None
2 parents 890e3a7 + a350ca6 commit f47fcc7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/libstd/io/util.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,11 @@ pub struct Empty { _priv: () }
7878
/// A slightly sad example of not reading anything into a buffer:
7979
///
8080
/// ```
81-
/// use std::io;
82-
/// use std::io::Read;
81+
/// use std::io::{self, Read};
8382
///
84-
/// # fn foo() -> io::Result<String> {
8583
/// let mut buffer = String::new();
86-
/// try!(io::empty().read_to_string(&mut buffer));
87-
/// # Ok(buffer)
88-
/// # }
84+
/// io::empty().read_to_string(&mut buffer).unwrap();
85+
/// assert!(buffer.is_empty());
8986
/// ```
9087
#[stable(feature = "rust1", since = "1.0.0")]
9188
pub fn empty() -> Empty { Empty { _priv: () } }

0 commit comments

Comments
 (0)