perf: use Vec::with_capacity and reserve_exact (#11904)

This commit is contained in:
nk_ysg
2024-10-21 19:59:09 +08:00
committed by GitHub
parent aba4991d0a
commit f25cceb9f9
13 changed files with 22 additions and 17 deletions

View File

@ -505,7 +505,7 @@ mod tests {
#[test]
fn compact_address() {
let mut buf = vec![];
let mut buf = Vec::with_capacity(21);
assert_eq!(Address::ZERO.to_compact(&mut buf), 20);
assert_eq!(buf, vec![0; 20]);