diff options
| author | bors <bors@rust-lang.org> | 2019-05-19 01:56:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-19 01:56:14 +0000 |
| commit | 26ab32499c0114ae6e01e76374ae06bcd7a973bd (patch) | |
| tree | 7d49276d07c041e3c8958d2d03778be4ec4a46f6 /src/libstd | |
| parent | 963184bbb670c1ffa97fc28a98cd5e8473118859 (diff) | |
| parent | 9389c694155f4bad4d1aaf5a78ee864155e8ae57 (diff) | |
| download | rust-26ab32499c0114ae6e01e76374ae06bcd7a973bd.tar.gz rust-26ab32499c0114ae6e01e76374ae06bcd7a973bd.zip | |
Auto merge of #60949 - Centril:rollup-f918e1v, r=Centril
Rollup of 8 pull requests Successful merges: - #60370 (Mark core::alloc::Layout::from_size_align_unchecked const) - #60678 (Stabilize vecdeque_rotate) - #60924 (Explain that ? converts the error type using From) - #60931 (Use iter() for iterating arrays by slice) - #60934 (Declare DefIndex with the newtype_index macro) - #60943 (fix copy-paste typo in docs for ptr::read_volatile) - #60945 (Simplify BufRead::fill_buf doc example using NLL) - #60947 (Fix typos in docs of GlobalAlloc) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/mod.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 8fea6251e65..917199f8ea8 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1579,18 +1579,13 @@ pub trait BufRead: Read { /// let stdin = io::stdin(); /// let mut stdin = stdin.lock(); /// - /// // we can't have two `&mut` references to `stdin`, so use a block - /// // to end the borrow early. - /// let length = { - /// let buffer = stdin.fill_buf().unwrap(); + /// let buffer = stdin.fill_buf().unwrap(); /// - /// // work with buffer - /// println!("{:?}", buffer); - /// - /// buffer.len() - /// }; + /// // work with buffer + /// println!("{:?}", buffer); /// /// // ensure the bytes we worked with aren't returned again later + /// let length = buffer.len(); /// stdin.consume(length); /// ``` #[stable(feature = "rust1", since = "1.0.0")] |
