summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-18 21:07:07 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-19 10:16:38 -0700
commit113be53df357c4e678d750c2a62b2949117954ab (patch)
tree74ceb5ca92d6c95963509e11e93fa59fb8d60ccf /src/comp/syntax
parent8c3ed8640b175ceeb1347415ed960532e20d64d2 (diff)
downloadrust-113be53df357c4e678d750c2a62b2949117954ab.tar.gz
rust-113be53df357c4e678d750c2a62b2949117954ab.zip
Do better at preserving blank lines during pretty-printing
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/print/pprust.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 07cd7537f5e..0ca54fceddc 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -1563,7 +1563,11 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
       }
       lexer::blank_line. {
         // We need to do at least one, possibly two hardbreaks.
-        if is_begin(s) || is_end(s) { hardbreak(s.s) }
+        let is_semi = alt s.s.last_token() {
+          pp::STRING(s, _) { s == ";" }
+          _ { false }
+        };
+        if is_semi || is_begin(s) || is_end(s) { hardbreak(s.s) }
         hardbreak(s.s);
       }
     }