Improve io::Read::read_buf_exact
error case
- Use `const_io_error` instead of `Error::new` - Use the same message as `read_exact`
This commit is contained in:
parent
cdaa12e3df
commit
a158fb33ef
@ -994,7 +994,10 @@ pub trait Read {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cursor.written() == prev_written {
|
if cursor.written() == prev_written {
|
||||||
return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
|
return Err(error::const_io_error!(
|
||||||
|
ErrorKind::UnexpectedEof,
|
||||||
|
"failed to fill whole buffer"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user