mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
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 {
|
||||
return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
|
||||
return Err(error::const_io_error!(
|
||||
ErrorKind::UnexpectedEof,
|
||||
"failed to fill whole buffer"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user