]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_ast_pretty/src/pprust/state.rs
Fix spacing and ordering of words in pretty printed Impl
[rust.git] / compiler / rustc_ast_pretty / src / pprust / state.rs
index f0c1d017326cddcf4964e61f43346783cab3b37a..c2253e63356a4325be95e94a81a970f5ae5e6c7e 100644 (file)
@@ -1285,14 +1285,17 @@ fn print_associated_type(
                 self.print_visibility(&item.vis);
                 self.print_defaultness(defaultness);
                 self.print_unsafety(unsafety);
-                self.word_nbsp("impl");
-                self.print_constness(constness);
+                self.word("impl");
 
-                if !generics.params.is_empty() {
+                if generics.params.is_empty() {
+                    self.nbsp();
+                } else {
                     self.print_generic_params(&generics.params);
                     self.space();
                 }
 
+                self.print_constness(constness);
+
                 if let ast::ImplPolarity::Negative(_) = polarity {
                     self.word("!");
                 }