about summary refs log tree commit diff
path: root/library/std/src/fs.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-17 05:44:08 +0000
committerbors <bors@rust-lang.org>2024-02-17 05:44:08 +0000
commitbbfce9196f1c2fb224cbccd7474f8f8623eebbf9 (patch)
tree4bdb17aaad138aa83a9464e32a25528bd360f020 /library/std/src/fs.rs
parentd2a4ef39ca8d83bbfc277b98133c11828dd5b16e (diff)
parentd523cab910d6b89b01dad9b283a67fb2256bc41e (diff)
Auto merge of #3303 - rust-lang:rustup-2024-02-17, r=saethlin
Automatic Rustup
Diffstat (limited to 'library/std/src/fs.rs')
-rw-r--r--library/std/src/fs.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index 3383a8cfa41..db8de1b1e3d 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -776,14 +776,14 @@ impl Read for &File {
     // Reserves space in the buffer based on the file size when available.
     fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
         let size = buffer_capacity_required(self);
-        buf.try_reserve_exact(size.unwrap_or(0)).map_err(|_| io::ErrorKind::OutOfMemory)?;
+        buf.try_reserve(size.unwrap_or(0)).map_err(|_| io::ErrorKind::OutOfMemory)?;
         io::default_read_to_end(self, buf, size)
     }
 
     // Reserves space in the buffer based on the file size when available.
     fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
         let size = buffer_capacity_required(self);
-        buf.try_reserve_exact(size.unwrap_or(0)).map_err(|_| io::ErrorKind::OutOfMemory)?;
+        buf.try_reserve(size.unwrap_or(0)).map_err(|_| io::ErrorKind::OutOfMemory)?;
         io::default_read_to_string(self, buf, size)
     }
 }