提交 b02f1f46 编写于 作者: B Brian Anderson

Don't pretty-print trailing whitespace for blank lines inside block comments

上级 84fb821e
......@@ -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);
}
}
......
// pp-exact
fn f() {
/*
The next line should not be indented.
That one. It shouldn't have been indented.
*/
}
// pp-exact
fn f() {
} /*
The next line should not be indented.
That one. It shouldn't have been indented.
*/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册