Skip to content

Commit c6c9fe5

Browse files
committed
---
yaml --- r: 4831 b: refs/heads/master c: b02f1f4 h: refs/heads/master i: 4829: 053f114 4827: 26c6404 4823: 9783864 4815: 7c837af 4799: f747cd9 v: v3
1 parent 87605c9 commit c6c9fe5

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 84fb821e4036a65f78db1821d75b95526ed3fd76
2+
refs/heads/master: b02f1f46e550e8f87df6c3ec7f9721b1f4edc958

trunk/src/comp/syntax/print/pprust.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,12 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
15371537
}
15381538
lexer::isolated. {
15391539
pprust::hardbreak_if_not_bol(s);
1540-
for line: str in cmnt.lines { word(s.s, line); hardbreak(s.s); }
1540+
for line: str in cmnt.lines {
1541+
// Don't print empty lines because they will end up as trailing
1542+
// whitespace
1543+
if str::is_not_empty(line) { word(s.s, line); }
1544+
hardbreak(s.s);
1545+
}
15411546
}
15421547
lexer::trailing. {
15431548
word(s.s, " ");
@@ -1546,7 +1551,10 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
15461551
hardbreak(s.s);
15471552
} else {
15481553
ibox(s, 0u);
1549-
for line: str in cmnt.lines { word(s.s, line); hardbreak(s.s); }
1554+
for line: str in cmnt.lines {
1555+
if str::is_not_empty(line) { word(s.s, line); }
1556+
hardbreak(s.s);
1557+
}
15501558
end(s);
15511559
}
15521560
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// pp-exact
2+
fn f() {
3+
/*
4+
The next line should not be indented.
5+
6+
That one. It shouldn't have been indented.
7+
*/
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// pp-exact
2+
fn f() {
3+
} /*
4+
The next line should not be indented.
5+
6+
That one. It shouldn't have been indented.
7+
*/

0 commit comments

Comments
 (0)