Skip to content

Commit fd80ab7

Browse files
committed
Specialize ToString implementation for fmt::Arguments
1 parent 9b99ff7 commit fd80ab7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

library/alloc/src/string.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,15 @@ impl ToString for String {
26142614
}
26152615
}
26162616

2617+
#[cfg(not(no_global_oom_handling))]
2618+
#[stable(feature = "fmt_arguments_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
2619+
impl ToString for fmt::Arguments<'_> {
2620+
#[inline]
2621+
fn to_string(&self) -> String {
2622+
crate::fmt::format(*self)
2623+
}
2624+
}
2625+
26172626
#[stable(feature = "rust1", since = "1.0.0")]
26182627
impl AsRef<str> for String {
26192628
#[inline]

0 commit comments

Comments
 (0)