Skip to content

Commit f5452b1

Browse files
committed
---
yaml --- r: 235344 b: refs/heads/stable c: b0ab164 h: refs/heads/master v: v3
1 parent b94de65 commit f5452b1

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 0bcbd169310556cfdc7b673df7992ba660ac4d3a
32+
refs/heads/stable: b0ab164b80f8d559cfc96e1d1d3819993672cced
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libcore/fmt/builders.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
175175
fn is_pretty(&self) -> bool {
176176
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
177177
}
178+
179+
/// Returns the wrapped `Formatter`.
180+
#[unstable(feature = "debug_builder_formatter", reason = "recently added")]
181+
pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
182+
&mut self.fmt
183+
}
178184
}
179185

180186
struct DebugInner<'a, 'b: 'a> {

branches/stable/src/libcore/fmt/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,16 @@ macro_rules! tuple {
14901490
fn fmt(&self, f: &mut Formatter) -> Result {
14911491
let mut builder = f.debug_tuple("");
14921492
let ($(ref $name,)*) = *self;
1493-
$(builder.field($name);)*
1493+
let mut n = 0;
1494+
$(
1495+
builder.field($name);
1496+
n += 1;
1497+
)*
1498+
1499+
if n == 1 {
1500+
try!(write!(builder.formatter(), ","));
1501+
}
1502+
14941503
builder.finish()
14951504
}
14961505
}

branches/stable/src/libcoretest/tuple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn test_tuple_cmp() {
6060
#[test]
6161
fn test_show() {
6262
let s = format!("{:?}", (1,));
63-
assert_eq!(s, "(1)");
63+
assert_eq!(s, "(1,)");
6464
let s = format!("{:?}", (1, true));
6565
assert_eq!(s, "(1, true)");
6666
let s = format!("{:?}", (1, "hi", true));

0 commit comments

Comments
 (0)