File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -1936,18 +1936,6 @@ impl<T: BufRead> BufRead for Take<T> {
1936
1936
}
1937
1937
}
1938
1938
1939
- fn read_one_byte ( reader : & mut dyn Read ) -> Option < Result < u8 > > {
1940
- let mut buf = [ 0 ] ;
1941
- loop {
1942
- return match reader. read ( & mut buf) {
1943
- Ok ( 0 ) => None ,
1944
- Ok ( ..) => Some ( Ok ( buf[ 0 ] ) ) ,
1945
- Err ( ref e) if e. kind ( ) == ErrorKind :: Interrupted => continue ,
1946
- Err ( e) => Some ( Err ( e) ) ,
1947
- } ;
1948
- }
1949
- }
1950
-
1951
1939
/// An iterator over `u8` values of a reader.
1952
1940
///
1953
1941
/// This struct is generally created by calling [`bytes`] on a reader.
@@ -1965,7 +1953,15 @@ impl<R: Read> Iterator for Bytes<R> {
1965
1953
type Item = Result < u8 > ;
1966
1954
1967
1955
fn next ( & mut self ) -> Option < Result < u8 > > {
1968
- read_one_byte ( & mut self . inner )
1956
+ let mut buf = [ 0 ] ;
1957
+ loop {
1958
+ return match self . inner . read ( & mut buf) {
1959
+ Err ( ref e) if e. kind ( ) == ErrorKind :: Interrupted => continue ,
1960
+ Ok ( 0 ) => None ,
1961
+ Ok ( ..) => Some ( Ok ( buf[ 0 ] ) ) ,
1962
+ Err ( e) => Some ( Err ( e) ) ,
1963
+ } ;
1964
+ }
1969
1965
}
1970
1966
}
1971
1967
You can’t perform that action at this time.
0 commit comments