about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMichael Sullivan <sully@msully.net>2011-08-03 17:52:25 -0700
committerMichael Sullivan <sully@msully.net>2011-08-03 17:52:25 -0700
commit5ea8d7f467472f8f368731e991320bbe2292880f (patch)
treed1daf1609361393198f5e7d9d2be21dd1271e795 /src
parent9bfbb2bf8368a5f46cef5848aac2e7058cf70650 (diff)
downloadrust-5ea8d7f467472f8f368731e991320bbe2292880f.tar.gz
rust-5ea8d7f467472f8f368731e991320bbe2292880f.zip
Make the pretty printer put trailing newlines at the end of files.
Diffstat (limited to 'src')
-rw-r--r--src/comp/syntax/print/pprust.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index e99414d98a5..dab764c5baa 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -1368,6 +1368,9 @@ fn maybe_print_trailing_comment(s: &ps, span: codemap::span,
 }
 
 fn print_remaining_comments(s: &ps) {
+    // If there aren't any remaining comments, then we need to manually
+    // make sure there is a line break at the end.
+    if option::is_none(next_comment(s)) { hardbreak(s.s); }
     while true {
         alt next_comment(s) {
           some(cmnt) { print_comment(s, cmnt); s.cur_cmnt += 1u; }