diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 3067766fb4d..1409310339a 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -2148,9 +2148,11 @@ impl<'a> State<'a> {
                 s.print_implicit_self(&decl.implicit_self);
             } else {
                 if let Some(arg_name) = arg_names.get(i) {
-                    s.word(arg_name.to_string());
-                    s.word(":");
-                    s.space();
+                    if arg_name.name != kw::Empty {
+                        s.word(arg_name.to_string());
+                        s.word(":");
+                        s.space();
+                    }
                 } else if let Some(body_id) = body_id {
                     s.ann.nested(s, Nested::BodyParamPat(body_id, i));
                     s.word(":");
diff --git a/tests/pretty/hir-fn-params.pp b/tests/pretty/hir-fn-params.pp
index f33e26b7e8c..3799c8a3c3b 100644
--- a/tests/pretty/hir-fn-params.pp
+++ b/tests/pretty/hir-fn-params.pp
@@ -27,12 +27,12 @@ impl S {
 // because they had similar problems. But the pretty-printing tests currently
 // can't contain compile errors.
 
-fn bare_fn(x: fn(: u32, _: u32, a: u32)) { }
+fn bare_fn(x: fn(u32, _: u32, a: u32)) { }
 
 extern "C" {
     unsafe fn foreign_fn(_: u32, a: u32);
 }
 
 trait T {
-    fn trait_fn(: u32, _: u32, a: u32);
+    fn trait_fn(u32, _: u32, a: u32);
 }