let mut s = String::new();
s += &format!("0x{:X}", 1024);
s.push_str(&format!("0x{:X}", 1024));
which does one extra heap allocation than necessary.
Since we promote all warnings to errors, builds on 1.62.0 will fail.
We refactor construct_backtrace() to allocate, format and return the
backtrace string in a single go and add a test to ensure the format
stays consistent.
Rust 1.62.0 comes with a new clippy warn: https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string.
It complains about code like:
which does one extra heap allocation than necessary. Since we promote all warnings to errors, builds on 1.62.0 will fail.
We refactor construct_backtrace() to allocate, format and return the backtrace string in a single go and add a test to ensure the format stays consistent.
Signed-off-by: Sabin Rapan sabrapan@amazon.com
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.