Cleanup 'print_generic_params'.

This commit is contained in:
Mazdak Farrokhzad 2019-08-02 08:36:08 +02:00
parent 435236b887
commit 875cef0324

View File

@ -2639,27 +2639,23 @@ impl<'a> State<'a> {
self.s.word("<");
self.commasep(Inconsistent, &generic_params, |s, param| {
s.print_outer_attributes_inline(&param.attrs);
match param.kind {
ast::GenericParamKind::Lifetime => {
s.print_outer_attributes_inline(&param.attrs);
let lt = ast::Lifetime { id: param.id, ident: param.ident };
s.print_lifetime_bounds(lt, &param.bounds)
}
ast::GenericParamKind::Type { ref default } => {
s.print_outer_attributes_inline(&param.attrs);
s.print_ident(param.ident);
s.print_type_bounds(":", &param.bounds);
match default {
Some(ref default) => {
s.s.space();
s.word_space("=");
s.print_type(default)
}
_ => {}
if let Some(ref default) = default {
s.s.space();
s.word_space("=");
s.print_type(default)
}
}
ast::GenericParamKind::Const { ref ty } => {
s.print_outer_attributes_inline(&param.attrs);
s.word_space("const");
s.print_ident(param.ident);
s.s.space();