]> git.lizzy.rs Git - rust.git/commitdiff
Cleanup 'print_generic_params'.
authorMazdak Farrokhzad <twingoow@gmail.com>
Fri, 2 Aug 2019 06:36:08 +0000 (08:36 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Fri, 2 Aug 2019 06:36:08 +0000 (08:36 +0200)
src/libsyntax/print/pprust.rs

index 88ff6ee9071014deb7efefb3b46af59be7ba269c..8c4c90f208521e56d3db19bb8173e398040b8b4a 100644 (file)
@@ -2639,27 +2639,23 @@ fn print_explicit_self(&mut self, explicit_self: &ast::ExplicitSelf) {
         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();