Skip to content

Commit

Permalink
Use with_capacity(0) because we're reading the capacity later on
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Oct 10, 2024
1 parent 6d075dc commit b62ee10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b62ee10

Please sign in to comment.