Skip to content

Commit

Permalink
Auto merge of #108235 - tmiasko:read-buf, r=the8472
Browse files Browse the repository at this point in the history
Use custom implementation of read_buf in Read for &'a FileDesc

This allows to skip an unnecessary buffer initialization.

Fixes #108223.
  • Loading branch information
bors committed Feb 20, 2023
2 parents 7b55296 + b118569 commit 824f915
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/std/src/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ impl<'a> Read for &'a FileDesc {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf)
}

fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
(**self).read_buf(cursor)
}
}

impl AsInner<OwnedFd> for FileDesc {
Expand Down

0 comments on commit 824f915

Please sign in to comment.