about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/show.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/ext/deriving/show.rs')
-rw-r--r--src/libsyntax/ext/deriving/show.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libsyntax/ext/deriving/show.rs b/src/libsyntax/ext/deriving/show.rs
index aeaf53a1939..343100d3a8e 100644
--- a/src/libsyntax/ext/deriving/show.rs
+++ b/src/libsyntax/ext/deriving/show.rs
@@ -120,23 +120,18 @@ fn show_substructure(cx: &mut ExtCtxt, span: Span,
     // AST construction!
     // we're basically calling
     //
-    // format_arg!(|__args| ::std::fmt::write(fmt.buf, __args), "<format_string>", exprs...)
+    // format_arg_method!(fmt, write_fmt, "<format_string>", exprs...)
     //
     // but doing it directly via ext::format.
     let formatter = substr.nonself_args[0];
-    let buf = cx.expr_field_access(span, formatter, cx.ident_of("buf"));
-
-    let std_write = vec!(cx.ident_of("std"), cx.ident_of("fmt"), cx.ident_of("write"));
-    let args = cx.ident_of("__args");
-    let write_call = cx.expr_call_global(span, std_write, vec!(buf, cx.expr_ident(span, args)));
-    let format_closure = cx.lambda_expr(span, vec!(args), write_call);
 
+    let meth = cx.ident_of("write_fmt");
     let s = token::intern_and_get_ident(format_string.as_slice());
     let format_string = cx.expr_str(span, s);
 
     // phew, not our responsibility any more!
     format::expand_preparsed_format_args(cx, span,
-                                         format_closure,
+                                         format::MethodCall(formatter, meth),
                                          format_string, exprs, Vec::new(),
                                          HashMap::new())
 }