rust-chg: add brief comment about initial capacity of temp_sock_path()
authorYuya Nishihara <yuya@tcha.org>
Sun, 14 Oct 2018 14:41:14 +0200
changeset 44668 c11d98cff883
parent 44666 e7af56a0733e
child 44669 1c385b99a360
rust-chg: add brief comment about initial capacity of temp_sock_path() I don't know if it can be expressed as a compile-time constant, so it's a comment for now. About this series: This is quite old patches for rust-chg. I heard from Octobus people that there's a plan to do an experiment on merging hgcli + chg + some Rust?, so I decided to respin the rust-chg series. Maybe we'll rewrite the core to leverage the recent async/await functionality, but I want to first make my old patches in so the rust-chg can be a drop-in replacement for the chg of C. Compiler warnings will be removed later, and the codebase will be upgraded to the 2018 edition later. Differential Revision: https://phab.mercurial-scm.org/D8357
rust/chg/src/locator.rs
--- a/rust/chg/src/locator.rs	Wed Apr 01 14:34:21 2020 -0700
+++ b/rust/chg/src/locator.rs	Sun Oct 14 14:41:14 2018 +0200
@@ -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()