Skip to content

Commit

Permalink
libstd: use fmt! in to_str impl for (one|two)-tuple
Browse files Browse the repository at this point in the history
The three-tuple uses fmt!, and there's no reason to hand-concatenate
strings.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
  • Loading branch information
artagnon committed Jun 6, 2013
1 parent ab10b1e commit 01c4f11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libstd/to_str.rs
Expand Up @@ -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())
}
}
}
Expand Down Expand Up @@ -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())
}
}
}
Expand Down

5 comments on commit 01c4f11

@bors
Copy link
Contributor

@bors bors commented on 01c4f11 Jun 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 01c4f11 Jun 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging artagnon/rust/tuple-tostr = 01c4f11 into auto

@bors
Copy link
Contributor

@bors bors commented on 01c4f11 Jun 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

artagnon/rust/tuple-tostr = 01c4f11 merged ok, testing candidate = 021e6d3

@bors
Copy link
Contributor

@bors bors commented on 01c4f11 Jun 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 01c4f11 Jun 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = 021e6d3

Please sign in to comment.