From b118569268e4b9f47757f0920aab353675af2da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sun, 19 Feb 2023 00:00:00 +0000 Subject: [PATCH] Use custom implementation of read_buf in Read for &'a FileDesc This allows to skip an unnecessary buffer initialization. --- library/std/src/sys/unix/fd.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs index dbaa3c33e2e57..ab57fba6c9f27 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 { (**self).read(buf) } + + fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> { + (**self).read_buf(cursor) + } } impl AsInner for FileDesc {