Avoid unnecessary allocations.

This commit is contained in:
Stephen Chung
2022-05-07 16:29:20 +08:00
parent 4194e2c048
commit b4fea634b0
2 changed files with 10 additions and 4 deletions

View File

@@ -195,12 +195,16 @@ mod print_debug_functions {
result.push_str("#{");
map.iter_mut().enumerate().for_each(|(i, (k, v))| {
result.push_str(&format!(
use std::fmt::Write;
write!(
result,
"{:?}: {}{}",
k,
&print_with_func(FUNC_TO_DEBUG, &ctx, v),
if i < len - 1 { ", " } else { "" }
));
)
.unwrap();
});
result.push('}');