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>
This commit is contained in:
Ramkumar Ramachandra 2013-06-06 20:47:04 +05:30
parent ab10b1ed29
commit 01c4f11cf8
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ impl<A:ToStr> ToStr for (A,) {
fn to_str(&self) -> ~str {
match *self {
(ref a,) => {
~"(" + a.to_str() + ",)"
fmt!("(%s,)", (*a).to_str())
}
}
}
@ -95,7 +95,7 @@ impl<A:ToStr,B:ToStr> ToStr for (A, B) {
//let &(ref a, ref b) = self;
match *self {
(ref a, ref b) => {
~"(" + a.to_str() + ", " + b.to_str() + ")"
fmt!("(%s, %s)", (*a).to_str(), (*b).to_str())
}
}
}