about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-01-26 09:33:18 +0000
committerbors <bors@rust-lang.org>2016-01-26 09:33:18 +0000
commit1972c50b9eaab85742c0a6f5ea7eade5eb0d63fc (patch)
tree3027a604dd832109572d910e9b8cba0754238e96 /src/libsyntax
parentacf4aeeda06b5355060e3dd8316e096465242f94 (diff)
parent014fc0235a992ad23eb486e228a711de00367919 (diff)
downloadrust-1972c50b9eaab85742c0a6f5ea7eade5eb0d63fc.tar.gz
rust-1972c50b9eaab85742c0a6f5ea7eade5eb0d63fc.zip
Auto merge of #31160 - nxnfufunezn:ppwild-31073, r=eddyb
Fixes #31073
r? @eddyb
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/print/pprust.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 67817ee0740..fe54651590f 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -425,7 +425,7 @@ pub fn variant_to_string(var: &ast::Variant) -> String {
 }
 
 pub fn arg_to_string(arg: &ast::Arg) -> String {
-    to_string(|s| s.print_arg(arg))
+    to_string(|s| s.print_arg(arg, false))
 }
 
 pub fn mac_to_string(arg: &ast::Mac) -> String {
@@ -2672,8 +2672,8 @@ impl<'a> State<'a> {
     }
 
     pub fn print_fn_args(&mut self, decl: &ast::FnDecl,
-                         opt_explicit_self: Option<&ast::ExplicitSelf_>)
-        -> io::Result<()> {
+                         opt_explicit_self: Option<&ast::ExplicitSelf_>,
+                         is_closure: bool) -> io::Result<()> {
         // It is unfortunate to duplicate the commasep logic, but we want the
         // self type and the args all in the same box.
         try!(self.rbox(0, Inconsistent));
@@ -2698,7 +2698,7 @@ impl<'a> State<'a> {
 
         for arg in args {
             if first { first = false; } else { try!(self.word_space(",")); }
-            try!(self.print_arg(arg));
+            try!(self.print_arg(arg, is_closure));
         }
 
         self.end()
@@ -2708,7 +2708,7 @@ impl<'a> State<'a> {
                                  opt_explicit_self: Option<&ast::ExplicitSelf_>)
         -> io::Result<()> {
         try!(self.popen());
-        try!(self.print_fn_args(decl, opt_explicit_self));
+        try!(self.print_fn_args(decl, opt_explicit_self, false));
         if decl.variadic {
             try!(word(&mut self.s, ", ..."));
         }
@@ -2722,7 +2722,7 @@ impl<'a> State<'a> {
             decl: &ast::FnDecl)
             -> io::Result<()> {
         try!(word(&mut self.s, "|"));
-        try!(self.print_fn_args(decl, None));
+        try!(self.print_fn_args(decl, None, true));
         try!(word(&mut self.s, "|"));
 
         if let ast::DefaultReturn(..) = decl.output {
@@ -2967,10 +2967,10 @@ impl<'a> State<'a> {
         self.print_type(&*mt.ty)
     }
 
-    pub fn print_arg(&mut self, input: &ast::Arg) -> io::Result<()> {
+    pub fn print_arg(&mut self, input: &ast::Arg, is_closure: bool) -> io::Result<()> {
         try!(self.ibox(INDENT_UNIT));
         match input.ty.node {
-            ast::TyInfer => try!(self.print_pat(&*input.pat)),
+            ast::TyInfer if is_closure => try!(self.print_pat(&*input.pat)),
             _ => {
                 match input.pat.node {
                     ast::PatIdent(_, ref path1, _) if