about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-20 03:49:04 +0000
committerbors <bors@rust-lang.org>2023-02-20 03:49:04 +0000
commit824f915cbc32c0942122389274a1b6fbe2ffc51e (patch)
tree51b834a7a485e1e319958843739aa20a244d9a8a
parent7b552967b8ed122aa949cddac8c2270b6490e64e (diff)
parentb118569268e4b9f47757f0920aab353675af2da0 (diff)
downloadrust-824f915cbc32c0942122389274a1b6fbe2ffc51e.tar.gz
rust-824f915cbc32c0942122389274a1b6fbe2ffc51e.zip
Auto merge of #108235 - tmiasko:read-buf, r=the8472
Use custom implementation of read_buf in Read for &'a FileDesc

This allows to skip an unnecessary buffer initialization.

Fixes #108223.
-rw-r--r--library/std/src/sys/unix/fd.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs
index dbaa3c33e2e..ab57fba6c9f 100644
--- a/library/std/src/sys/unix/fd.rs
+++ b/library/std/src/sys/unix/fd.rs
@@ -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 {