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<T>` 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.
This commit is contained in:
Alex Crichton
2015-01-07 14:58:31 -08:00
parent 9f1ead8fad
commit 9851b4fbbf
22 changed files with 76 additions and 109 deletions

View File

@@ -585,6 +585,13 @@ impl<T: fmt::Show> fmt::Show for Arc<T> {
}
}
#[stable]
impl<T: fmt::String> fmt::String for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::String::fmt(&**self, f)
}
}
#[stable]
impl<T: Default + Sync + Send> Default for Arc<T> {
#[stable]