about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-18 19:19:38 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-18 19:22:10 -0700
commitb02f1f46e550e8f87df6c3ec7f9721b1f4edc958 (patch)
tree7819b74afe2ac7e29dfd33003a3e8c7e2c49f398 /src/comp/syntax
parent84fb821e4036a65f78db1821d75b95526ed3fd76 (diff)
Don't pretty-print trailing whitespace for blank lines inside block comments
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/print/pprust.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 59531683074..a90088f2142 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -1537,7 +1537,12 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
       }
       lexer::isolated. {
         pprust::hardbreak_if_not_bol(s);
-        for line: str in cmnt.lines { word(s.s, line); hardbreak(s.s); }
+        for line: str in cmnt.lines {
+            // Don't print empty lines because they will end up as trailing
+            // whitespace
+            if str::is_not_empty(line) { word(s.s, line); }
+            hardbreak(s.s);
+        }
       }
       lexer::trailing. {
         word(s.s, " ");
@@ -1546,7 +1551,10 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
             hardbreak(s.s);
         } else {
             ibox(s, 0u);
-            for line: str in cmnt.lines { word(s.s, line); hardbreak(s.s); }
+            for line: str in cmnt.lines {
+                if str::is_not_empty(line) { word(s.s, line); }
+                hardbreak(s.s);
+            }
             end(s);
         }
       }