Skip to content

Commit a24e238

Browse files
committed
Fix spacing and ordering of words in pretty printed Impl
1 parent f3df63f commit a24e238

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

compiler/rustc_ast_pretty/src/pprust/state.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1285,14 +1285,17 @@ impl<'a> State<'a> {
12851285
self.print_visibility(&item.vis);
12861286
self.print_defaultness(defaultness);
12871287
self.print_unsafety(unsafety);
1288-
self.word_nbsp("impl");
1289-
self.print_constness(constness);
1288+
self.word("impl");
12901289

1291-
if !generics.params.is_empty() {
1290+
if generics.params.is_empty() {
1291+
self.nbsp();
1292+
} else {
12921293
self.print_generic_params(&generics.params);
12931294
self.space();
12941295
}
12951296

1297+
self.print_constness(constness);
1298+
12961299
if let ast::ImplPolarity::Negative(_) = polarity {
12971300
self.word("!");
12981301
}

src/test/ui/macros/stringify.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ fn test_item() {
603603
stringify_item!(
604604
impl<T> Struct<T> {}
605605
),
606-
"impl <T> Struct<T> {}", // FIXME
606+
"impl<T> Struct<T> {}",
607607
);
608608
assert_eq!(
609609
stringify_item!(
@@ -615,7 +615,7 @@ fn test_item() {
615615
stringify_item!(
616616
impl<T> const Trait for T {}
617617
),
618-
"impl const <T> Trait for T {}", // FIXME
618+
"impl<T> const Trait for T {}",
619619
);
620620
assert_eq!(
621621
stringify_item!(

0 commit comments

Comments
 (0)