about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix/os.rs
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-10-10 18:57:44 +0200
committerMads Marquart <mads@marquart.dk>2024-10-10 18:57:44 +0200
commitb62ee10e5448a077e67e46f6907a4a04415895a8 (patch)
treea7f31c9a0b265b9d77c33cf19a22aad930e9bf9c /library/std/src/sys/pal/unix/os.rs
parent6d075dc4d7335a239f887b28a630bdc9aa08e140 (diff)
downloadrust-b62ee10e5448a077e67e46f6907a4a04415895a8.tar.gz
rust-b62ee10e5448a077e67e46f6907a4a04415895a8.zip
Use with_capacity(0) because we're reading the capacity later on
Diffstat (limited to 'library/std/src/sys/pal/unix/os.rs')
-rw-r--r--library/std/src/sys/pal/unix/os.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index 9750c32eed5..d26a1bdef74 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -706,7 +706,7 @@ pub fn page_size() -> usize {
 //     https://pubs.opengroup.org/onlinepubs/9699919799/functions/confstr.html
 #[cfg(target_vendor = "apple")]
 fn confstr(key: c_int, size_hint: Option<usize>) -> io::Result<OsString> {
-    let mut buf: Vec<u8> = Vec::new();
+    let mut buf: Vec<u8> = Vec::with_capacity(0);
     let mut bytes_needed_including_nul = size_hint
         .unwrap_or_else(|| {
             // Treat "None" as "do an extra call to get the length". In theory