]> git.lizzy.rs Git - rust.git/commitdiff
pprust: Remove the box from `print_tts`
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 13 Jul 2019 20:11:04 +0000 (23:11 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Mon, 15 Jul 2019 09:42:07 +0000 (12:42 +0300)
Wrap the whole attribute into a box instead

src/libsyntax/print/pprust.rs

index 77f2dff0d8eba16b919478d5a345ecc8fcb7916f..e101168a1370a68bb3bf5d947a2ac885cfd93949 100644 (file)
@@ -616,6 +616,7 @@ fn print_attribute_inline(&mut self, attr: &ast::Attribute,
                 ast::AttrStyle::Inner => self.word("#!["),
                 ast::AttrStyle::Outer => self.word("#["),
             }
+            self.ibox(0);
             if let Some(mi) = attr.meta() {
                 self.print_meta_item(&mi);
             } else {
@@ -634,6 +635,7 @@ fn print_attribute_inline(&mut self, attr: &ast::Attribute,
                     }
                 }
             }
+            self.end();
             self.word("]");
         }
     }
@@ -698,14 +700,12 @@ fn print_tt(&mut self, tt: tokenstream::TokenTree, convert_dollar_crate: bool) {
     }
 
     fn print_tts(&mut self, tts: tokenstream::TokenStream, convert_dollar_crate: bool) {
-        self.ibox(0);
         for (i, tt) in tts.into_trees().enumerate() {
             if i != 0 {
                 self.space();
             }
             self.print_tt(tt, convert_dollar_crate);
         }
-        self.end();
     }
 
     fn print_mac_common(
@@ -738,7 +738,9 @@ fn print_mac_common(
                 self.bopen();
             }
         }
+        self.ibox(0);
         self.print_tts(tts, convert_dollar_crate);
+        self.end();
         match delim {
             DelimToken::Paren => self.pclose(),
             DelimToken::Bracket => self.word("]"),