Specialize ToString implementation for fmt::Arguments

This commit is contained in:
DaniPopes 2023-05-04 00:43:17 +02:00
parent 9b99ff76b2
commit fd80ab7f13
No known key found for this signature in database
GPG Key ID: 0F09640DDB7AC692

View File

@ -2614,6 +2614,15 @@ impl ToString for String {
}
}
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "fmt_arguments_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
impl ToString for fmt::Arguments<'_> {
#[inline]
fn to_string(&self) -> String {
crate::fmt::format(*self)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl AsRef<str> for String {
#[inline]