Skip to content

Commit 697b83b

Browse files
authored
Removed unnecessary buf subscript
1 parent f59d645 commit 697b83b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/libstd/io/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@
271271

272272
use cmp;
273273
use fmt;
274+
use slice;
274275
use str;
275276
use memchr;
276277
use ptr;
@@ -285,7 +286,7 @@ pub use self::cursor::Cursor;
285286
pub use self::error::{Result, Error, ErrorKind};
286287
#[stable(feature = "rust1", since = "1.0.0")]
287288
pub use self::util::{copy, sink, Sink, empty, Empty, repeat, Repeat};
288-
#[stable(feature = "rust1", since = "1.0.0")]
289+
#[stable(feature = "rust1", since = "1.0.0")]f
289290
pub use self::stdio::{stdin, stdout, stderr, Stdin, Stdout, Stderr};
290291
#[stable(feature = "rust1", since = "1.0.0")]
291292
pub use self::stdio::{StdoutLock, StderrLock, StdinLock};
@@ -1953,12 +1954,12 @@ impl<R: Read> Iterator for Bytes<R> {
19531954
type Item = Result<u8>;
19541955

19551956
fn next(&mut self) -> Option<Result<u8>> {
1956-
let mut buf = [0];
1957+
let mut byte = 0;
19571958
loop {
1958-
return match self.inner.read(&mut buf) {
1959+
return match self.inner.read(slice::from_mut(&mut byte)) {
19591960
Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
19601961
Ok(0) => None,
1961-
Ok(..) => Some(Ok(buf[0])),
1962+
Ok(..) => Some(Ok(byte)),
19621963
Err(e) => Some(Err(e)),
19631964
};
19641965
}

0 commit comments

Comments
 (0)