diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-07 17:18:59 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-07 17:18:59 -0800 |
| commit | a204dc56c97f35632575b1baa008f2e069b1bed9 (patch) | |
| tree | b55c302f46d0adb457d3ce2f250bc0b1209d0996 /src/libcollections/string.rs | |
| parent | a6bf7676a545f72cef2e3d042b6d0409f295693a (diff) | |
| parent | 9851b4fbbf327bb1baab3182ce92970d4db22c6c (diff) | |
| download | rust-a204dc56c97f35632575b1baa008f2e069b1bed9.tar.gz rust-a204dc56c97f35632575b1baa008f2e069b1bed9.zip | |
rollup merge of #20722: alexcrichton/audit-show
Conflicts: src/libcollections/vec.rs src/libcore/fmt/mod.rs src/librustdoc/html/format.rs
Diffstat (limited to 'src/libcollections/string.rs')
| -rw-r--r-- | src/libcollections/string.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index 2d8fd159159..32cd8661a56 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -681,6 +681,7 @@ impl fmt::Show for FromUtf8Error { } } +#[stable] impl fmt::String for FromUtf8Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::String::fmt(&self.error, f) @@ -693,6 +694,7 @@ impl fmt::Show for FromUtf16Error { } } +#[stable] impl fmt::String for FromUtf16Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::String::fmt("invalid utf-16: lone surrogate found", f) @@ -805,7 +807,7 @@ impl Default for String { } } -#[experimental = "waiting on fmt stabilization"] +#[stable] impl fmt::String for String { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::String::fmt(&**self, f) @@ -1274,18 +1276,17 @@ mod tests { assert_eq!(2u8.to_string(), "2"); assert_eq!(true.to_string(), "true"); assert_eq!(false.to_string(), "false"); - assert_eq!(().to_string(), "()"); assert_eq!(("hi".to_string()).to_string(), "hi"); } #[test] fn test_vectors() { let x: Vec<int> = vec![]; - assert_eq!(x.to_string(), "[]"); - assert_eq!((vec![1i]).to_string(), "[1]"); - assert_eq!((vec![1i, 2, 3]).to_string(), "[1, 2, 3]"); - assert!((vec![vec![], vec![1i], vec![1i, 1]]).to_string() == - "[[], [1], [1, 1]]"); + assert_eq!(format!("{:?}", x), "[]"); + assert_eq!(format!("{:?}", vec![1i]), "[1i]"); + assert_eq!(format!("{:?}", vec![1i, 2, 3]), "[1i, 2i, 3i]"); + assert!(format!("{:?}", vec![vec![], vec![1i], vec![1i, 1]]) == + "[[], [1i], [1i, 1i]]"); } #[test] |
