remove useless cold

This commit is contained in:
Conrad Ludgate 2022-05-28 12:08:27 +01:00
parent 3f404bfa86
commit 5dd0fe301a

View file

@ -606,13 +606,12 @@ use crate::string;
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[inline] #[inline]
pub fn format(args: Arguments<'_>) -> string::String { pub fn format(args: Arguments<'_>) -> string::String {
#[cold] fn format_inner(args: Arguments<'_>) -> string::String {
fn format_cold(args: Arguments<'_>) -> string::String {
let capacity = args.estimated_capacity(); let capacity = args.estimated_capacity();
let mut output = string::String::with_capacity(capacity); let mut output = string::String::with_capacity(capacity);
output.write_fmt(args).expect("a formatting trait implementation returned an error"); output.write_fmt(args).expect("a formatting trait implementation returned an error");
output output
} }
args.as_str().map_or_else(|| format_cold(args), crate::borrow::ToOwned::to_owned) args.as_str().map_or_else(|| format_inner(args), crate::borrow::ToOwned::to_owned)
} }