Rollup merge of #92417 - dtolnay:printimpl, r=jackh726
Fix spacing and ordering of words in pretty printed Impl Follow-up to #92238 fixing one of the FIXMEs. ```rust macro_rules! repro { ($item:item) => { stringify!($item) }; } fn main() { println!("{}", repro!(impl<T> Struct<T> {})); println!("{}", repro!(impl<T> const Trait for T {})); } ``` Before: `impl <T> Struct<T> {}` After: `impl<T> Struct<T> {}` Before: `impl const <T> Trait for T {}` 😿 After: `impl<T> const Trait for T {}`
This commit is contained in:
commit
1a8f69826c
2 changed files with 13 additions and 4 deletions
|
@ -1287,14 +1287,17 @@ impl<'a> State<'a> {
|
|||
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("!");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue