From 9851b4fbbf327bb1baab3182ce92970d4db22c6c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 7 Jan 2015 14:58:31 -0800 Subject: std: Tweak String implementations This commit performs a pass over the implementations of the new `String` trait in the formatting module. Some implementations were removed as a conservative move pending an upcoming convention about `String` implementations, and some were added in order to retain consistency across the libraries. Specifically: * All "smart pointers" implement `String` now, adding missing implementations for `Arc` and `Rc`. * The `Vec` and `[T]` types no longer implement `String`. * The `*const T` and `*mut T` type no longer implement `String`. * The `()` type no longer implements `String`. * The `Path` type's `Show` implementation does not surround itself with `Path {}` (a minor tweak). All implementations of `String` in this PR were also marked `#[stable]` to indicate that the types will continue to implement the `String` trait regardless of what it looks like. --- src/liballoc/arc.rs | 7 +++++++ src/liballoc/boxed.rs | 1 + src/liballoc/rc.rs | 7 +++++++ 3 files changed, 15 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 5d47602b5e1..8a6afd2e264 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -585,6 +585,13 @@ impl fmt::Show for Arc { } } +#[stable] +impl fmt::String for Arc { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(&**self, f) + } +} + #[stable] impl Default for Arc { #[stable] diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index d46f18abf97..1943b1bd34b 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -149,6 +149,7 @@ impl fmt::Show for Box { } } +#[stable] impl fmt::String for Box { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::String::fmt(&**self, f) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 67b25427710..867f70df774 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -611,6 +611,13 @@ impl fmt::Show for Rc { } } +#[stable] +impl fmt::String for Rc { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::String::fmt(&**self, f) + } +} + /// A weak version of `Rc`. /// /// Weak references do not count when determining if the inner value should be dropped. -- cgit 1.4.1-3-g733a5