Skip to content

Commit 01c4f11

Browse files
committed
libstd: use fmt! in to_str impl for (one|two)-tuple
The three-tuple uses fmt!, and there's no reason to hand-concatenate strings. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
1 parent ab10b1e commit 01c4f11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/to_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<A:ToStr> ToStr for (A,) {
4444
fn to_str(&self) -> ~str {
4545
match *self {
4646
(ref a,) => {
47-
~"(" + a.to_str() + ",)"
47+
fmt!("(%s,)", (*a).to_str())
4848
}
4949
}
5050
}
@@ -95,7 +95,7 @@ impl<A:ToStr,B:ToStr> ToStr for (A, B) {
9595
//let &(ref a, ref b) = self;
9696
match *self {
9797
(ref a, ref b) => {
98-
~"(" + a.to_str() + ", " + b.to_str() + ")"
98+
fmt!("(%s, %s)", (*a).to_str(), (*b).to_str())
9999
}
100100
}
101101
}

0 commit comments

Comments
 (0)