Skip to content

Commit a158fb3

Browse files
committed
Improve io::Read::read_buf_exact error case
- Use `const_io_error` instead of `Error::new` - Use the same message as `read_exact`
1 parent cdaa12e commit a158fb3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/io/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,10 @@ pub trait Read {
994994
}
995995

996996
if cursor.written() == prev_written {
997-
return Err(Error::new(ErrorKind::UnexpectedEof, "failed to fill buffer"));
997+
return Err(error::const_io_error!(
998+
ErrorKind::UnexpectedEof,
999+
"failed to fill whole buffer"
1000+
));
9981001
}
9991002
}
10001003

0 commit comments

Comments
 (0)