Skip to content

Commit f7be960

Browse files
committed
---
yaml --- r: 149102 b: refs/heads/try2 c: 0e005ab h: refs/heads/master v: v3
1 parent 6928890 commit f7be960

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 0f5baad6ee5191991d18271aabebaf3fc6124424
8+
refs/heads/try2: 0e005ab84892aa201f720cc60d2aef002bfd7a4a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ext/deriving/to_str.rs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,31 +67,32 @@ fn to_str_substructure(cx: &mut ExtCtxt, span: Span, substr: &Substructure)
6767
let mut stmts = ~[cx.stmt_let(span, true, buf, init)];
6868
let push_str = cx.ident_of("push_str");
6969

70-
let push = |s: @Expr| {
71-
let ebuf = cx.expr_ident(span, buf);
72-
let call = cx.expr_method_call(span, ebuf, push_str, ~[s]);
73-
stmts.push(cx.stmt_expr(call));
74-
};
70+
{
71+
let push = |s: @Expr| {
72+
let ebuf = cx.expr_ident(span, buf);
73+
let call = cx.expr_method_call(span, ebuf, push_str, ~[s]);
74+
stmts.push(cx.stmt_expr(call));
75+
};
7576

76-
for (i, &FieldInfo {name, span, self_, .. }) in fields.iter().enumerate() {
77-
if i > 0 {
78-
push(cx.expr_str(span, InternedString::new(", ")));
79-
}
80-
match name {
81-
None => {}
82-
Some(id) => {
83-
let interned_id = token::get_ident(id.name);
84-
let name = interned_id.get() + ": ";
85-
push(cx.expr_str(span,
86-
token::intern_and_get_ident(name)));
77+
for (i, &FieldInfo {name, span, self_, .. }) in fields.iter().enumerate() {
78+
if i > 0 {
79+
push(cx.expr_str(span, InternedString::new(", ")));
80+
}
81+
match name {
82+
None => {}
83+
Some(id) => {
84+
let interned_id = token::get_ident(id.name);
85+
let name = interned_id.get() + ": ";
86+
push(cx.expr_str(span,
87+
token::intern_and_get_ident(name)));
88+
}
8789
}
90+
push(cx.expr_method_call(span, self_, to_str, ~[]));
8891
}
89-
push(cx.expr_method_call(span, self_, to_str, ~[]));
92+
push(cx.expr_str(span, end));
9093
}
91-
push(cx.expr_str(span, end));
9294

93-
cx.expr_block(cx.block(span, stmts, Some(cx.expr_ident(span,
94-
buf))))
95+
cx.expr_block(cx.block(span, stmts, Some(cx.expr_ident(span, buf))))
9596
}
9697
};
9798

0 commit comments

Comments
 (0)