minor change to capacity estimation

This commit is contained in:
ascendforever 2023-10-25 13:36:48 -04:00
parent a1eec572d1
commit fa95021065

View file

@ -193,7 +193,7 @@ fn assert_all_same_device(paths: &[PathBuf]) -> Result<(), String> {
if wrong.is_empty() { if wrong.is_empty() {
Ok(()) Ok(())
} else { } else {
let mut s = String::with_capacity(wrong.len()*120); // 67 max estimated len of path, 52 for prefix msg, 1 for newline let mut s = String::with_capacity(wrong.len()*128); // 75 max estimated len of path, 53 for prefix msg + nl
for path in wrong { for path in wrong {
s.push_str("Device ids must all be the same; got different for: {}"); s.push_str("Device ids must all be the same; got different for: {}");
s.push_str(&shlex::quote(&path.to_string_lossy())); s.push_str(&shlex::quote(&path.to_string_lossy()));