Skip to content

Commit 7469ae0

Browse files
committed
---
yaml --- r: 100870 b: refs/heads/snap-stage3 c: 6f39eb1 h: refs/heads/master v: v3
1 parent 54129b1 commit 7469ae0

File tree

3 files changed

+8
-49
lines changed

3 files changed

+8
-49
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e3b1f3c443c048913e2d573fcc5a9c2be3484a78
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bf6abf8cb3d1e169c1baab8d266bd43c58dfbcc6
4+
refs/heads/snap-stage3: 6f39eb1a568c03534a41f6815e7fb0bde737cd6f
55
refs/heads/try: a97642026c18a624ff6ea01075dd9550f8ed07ff
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/to_str.rs

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,6 @@ impl ToStr for () {
4040
fn to_str(&self) -> ~str { ~"()" }
4141
}
4242

43-
impl<A:ToStr> ToStr for (A,) {
44-
#[inline]
45-
fn to_str(&self) -> ~str {
46-
match *self {
47-
(ref a,) => {
48-
format!("({},)", (*a).to_str())
49-
}
50-
}
51-
}
52-
}
53-
5443
impl<A:ToStr+Hash+Eq, B:ToStr> ToStr for HashMap<A, B> {
5544
#[inline]
5645
fn to_str(&self) -> ~str {
@@ -91,36 +80,6 @@ impl<A:ToStr+Hash+Eq> ToStr for HashSet<A> {
9180
}
9281
}
9382
94-
impl<A:ToStr,B:ToStr> ToStr for (A, B) {
95-
#[inline]
96-
fn to_str(&self) -> ~str {
97-
// FIXME(#4653): this causes an llvm assertion
98-
//let &(ref a, ref b) = self;
99-
match *self {
100-
(ref a, ref b) => {
101-
format!("({}, {})", (*a).to_str(), (*b).to_str())
102-
}
103-
}
104-
}
105-
}
106-
107-
impl<A:ToStr,B:ToStr,C:ToStr> ToStr for (A, B, C) {
108-
#[inline]
109-
fn to_str(&self) -> ~str {
110-
// FIXME(#4653): this causes an llvm assertion
111-
//let &(ref a, ref b, ref c) = self;
112-
match *self {
113-
(ref a, ref b, ref c) => {
114-
format!("({}, {}, {})",
115-
(*a).to_str(),
116-
(*b).to_str(),
117-
(*c).to_str()
118-
)
119-
}
120-
}
121-
}
122-
}
123-
12483
impl<'a,A:ToStr> ToStr for &'a [A] {
12584
#[inline]
12685
fn to_str(&self) -> ~str {
@@ -178,13 +137,6 @@ mod tests {
178137
assert_eq!((~"hi").to_str(), ~"hi");
179138
}
180139
181-
#[test]
182-
fn test_tuple_types() {
183-
assert_eq!((1, 2).to_str(), ~"(1, 2)");
184-
assert_eq!((~"a", ~"b", false).to_str(), ~"(a, b, false)");
185-
assert_eq!(((), ((), 100)).to_str(), ~"((), ((), 100))");
186-
}
187-
188140
#[test]
189141
fn test_vectors() {
190142
let x: ~[int] = ~[];

branches/snap-stage3/src/libstd/tuple.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use clone::Clone;
1717
#[cfg(not(test))] use default::Default;
1818
use fmt;
1919
use result::{Ok, Err};
20+
use to_str::ToStr;
2021

2122
/// Method extensions to pairs where both types satisfy the `Clone` bound
2223
pub trait CloneableTuple<T, U> {
@@ -179,6 +180,12 @@ macro_rules! tuple_impls {
179180
}
180181
}
181182

183+
impl<$($T: fmt::Show),+> ToStr for ($($T,)+) {
184+
fn to_str(&self) -> ~str {
185+
format!("{}", *self)
186+
}
187+
}
188+
182189
impl<$($T: fmt::Show),+> fmt::Show for ($($T,)+) {
183190
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
184191
write_tuple!(f.buf, $(self.$get_ref_fn()),+)

0 commit comments

Comments
 (0)