File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -1579,18 +1579,13 @@ pub trait BufRead: Read {
15791579 /// let stdin = io::stdin();
15801580 /// let mut stdin = stdin.lock();
15811581 ///
1582- /// // we can't have two `&mut` references to `stdin`, so use a block
1583- /// // to end the borrow early.
1584- /// let length = {
1585- /// let buffer = stdin.fill_buf().unwrap();
1582+ /// let buffer = stdin.fill_buf().unwrap();
15861583 ///
1587- /// // work with buffer
1588- /// println!("{:?}", buffer);
1589- ///
1590- /// buffer.len()
1591- /// };
1584+ /// // work with buffer
1585+ /// println!("{:?}", buffer);
15921586 ///
15931587 /// // ensure the bytes we worked with aren't returned again later
1588+ /// let length = buffer.len();
15941589 /// stdin.consume(length);
15951590 /// ```
15961591 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments