Patchwork D8357: rust-chg: add brief comment about initial capacity of temp_sock_path()

login
register
mail settings
Submitter phabricator
Date April 3, 2020, 7:17 p.m.
Message ID <5a9b54922bc9b46cfa817ab10d015ca0@localhost.localdomain>
Download mbox | patch
Permalink /patch/46016/
State Not Applicable
Headers show

Comments

phabricator - April 3, 2020, 7:17 p.m.
Closed by commit rHGc11d98cff883: rust-chg: add brief comment about initial capacity of temp_sock_path() (authored by yuja).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8357?vs=20959&id=20986

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8357/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8357

AFFECTED FILES
  rust/chg/src/locator.rs

CHANGE DETAILS




To: yuja, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel

Patch

diff --git a/rust/chg/src/locator.rs b/rust/chg/src/locator.rs
--- a/rust/chg/src/locator.rs
+++ b/rust/chg/src/locator.rs
@@ -47,7 +47,7 @@ 
     /// Temporary socket path for this client process.
     fn temp_sock_path(&self) -> PathBuf {
         let src = self.base_sock_path.as_os_str().as_bytes();
-        let mut buf = Vec::with_capacity(src.len() + 6);
+        let mut buf = Vec::with_capacity(src.len() + 6); // "{src}.{pid}".len()
         buf.extend_from_slice(src);
         buf.extend_from_slice(format!(".{}", self.process_id).as_bytes());
         OsString::from_vec(buf).into()