Skip to content

Commit 26bcfc4

Browse files
committed
Use ToString specialization macro also for Cow and String
1 parent 340d76f commit 26bcfc4

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

library/alloc/src/string.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,6 +2966,8 @@ macro_rules! to_string_str {
29662966

29672967
#[cfg(not(no_global_oom_handling))]
29682968
to_string_str! {
2969+
Cow<'_, str>,
2970+
String,
29692971
// Generic/generated code can sometimes have multiple, nested references
29702972
// for strings, including `&&&str`s that would never be written
29712973
// by hand.
@@ -2983,22 +2985,6 @@ to_string_str! {
29832985
&str,
29842986
}
29852987

2986-
#[cfg(not(no_global_oom_handling))]
2987-
impl SpecToString for Cow<'_, str> {
2988-
#[inline]
2989-
fn spec_to_string(&self) -> String {
2990-
self[..].to_owned()
2991-
}
2992-
}
2993-
2994-
#[cfg(not(no_global_oom_handling))]
2995-
impl SpecToString for String {
2996-
#[inline]
2997-
fn spec_to_string(&self) -> String {
2998-
self.to_owned()
2999-
}
3000-
}
3001-
30022988
#[cfg(not(no_global_oom_handling))]
30032989
impl SpecToString for fmt::Arguments<'_> {
30042990
#[inline]

0 commit comments

Comments
 (0)