Zero-pad the random number suffix of TempPathBufs.

This way, the hex number is always 16 digits, which is helpful for test
verification as well as simple consistency.
This commit is contained in:
Tim Kuehn
2022-10-03 18:50:46 -07:00
parent d832209da3
commit 49ba8f8b1b

View File

@@ -443,7 +443,7 @@ pub mod unix {
/// Appends a random hex string to the socket name resulting in
/// `<tempdir>/<name>_<xxxxx>`
pub fn with_random<S: AsRef<str>>(name: S) -> Self {
Self::new(format!("{}_{:x}", name.as_ref(), rand::random::<u64>()))
Self::new(format!("{}_{:016x}", name.as_ref(), rand::random::<u64>()))
}
}