Closed
Description
rustc fails to warn about unused mut
for buf
in this case:
use std::io;
pub fn read_all<R: io::Read + ?Sized>(this: &mut R, mut buf: &mut [u8]) -> io::Result<()> {
let mut total = 0;
while total < buf.len() {
match this.read(&mut buf[total..]) {
Ok(0) => return Err(io::Error::new(io::ErrorKind::Other,
"failed to read whole buffer")),
Ok(n) => total += n,
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {}
Err(e) => return Err(e),
}
}
Ok(())
}
fn main() {}