diff options
| author | Benoît du Garreau <bdgdlm@outlook.com> | 2024-01-31 11:05:41 +0100 |
|---|---|---|
| committer | Benoît du Garreau <bdgdlm@outlook.com> | 2024-01-31 11:06:19 +0100 |
| commit | a158fb33effaee88bfce664a4dd201c61ff4bb10 (patch) | |
| tree | 3b460d092ff588d518b20c4942fd639beee53b9d /library/std/src | |
| parent | cdaa12e3dff109f72a5a8a0a67ea225052122a79 (diff) | |
| download | rust-a158fb33effaee88bfce664a4dd201c61ff4bb10.tar.gz rust-a158fb33effaee88bfce664a4dd201c61ff4bb10.zip | |
Improve `io::Read::read_buf_exact` error case
- Use `const_io_error` instead of `Error::new` - Use the same message as `read_exact`
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/io/mod.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index 8fca66fa17c..ee79d47ddd9 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -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" + )); } } |
