Removed compiler warning (tested)
This commit is contained in:
parent
1c4cd7d51a
commit
470954cb00
|
@ -19,10 +19,8 @@ impl<R: Read> UnsafeBufReader<R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_capacity(capacity: usize, inner: R) -> UnsafeBufReader<R> {
|
pub fn with_capacity(capacity: usize, inner: R) -> UnsafeBufReader<R> {
|
||||||
unsafe {
|
let buf = Box::new_uninit_slice(capacity);
|
||||||
let buf = Box::new_uninit_slice(capacity);
|
UnsafeBufReader { inner, buf, pos: 0, cap: 0, init: 0 }
|
||||||
UnsafeBufReader { inner, buf, pos: 0, cap: 0, init: 0 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn buffer(&self) -> &[u8] {
|
pub fn buffer(&self) -> &[u8] {
|
||||||
|
@ -61,9 +59,7 @@ impl<R: Read> UnsafeBufRead for UnsafeBufReader<R> {
|
||||||
unsafe {
|
unsafe {
|
||||||
readbuf.assume_init(self.init);
|
readbuf.assume_init(self.init);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.inner.read_buf(&mut readbuf)?;
|
self.inner.read_buf(&mut readbuf)?;
|
||||||
|
|
||||||
self.cap = readbuf.filled_len();
|
self.cap = readbuf.filled_len();
|
||||||
self.init = readbuf.initialized_len();
|
self.init = readbuf.initialized_len();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue