Skip to content
This repository was archived by the owner on Aug 12, 2021. It is now read-only.

Commit 9060be3

Browse files
committed
Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2 parents 1cead75 + 21c53bc commit 9060be3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

terminfo/parser/compiled.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub fn parse(file: &mut dyn io::Read, longnames: bool) -> Result<TermInfo, Strin
189189
macro_rules! t( ($e:expr) => (
190190
match $e {
191191
Ok(e) => e,
192-
Err(e) => return Err(format!("{}", e))
192+
Err(e) => return Err(e.to_string())
193193
}
194194
) );
195195

0 commit comments

Comments
 (0)