mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Don't pp extra lines after block open when preserving whitespace. Closes #759
This commit is contained in:
parent
731797d075
commit
3eef9993af
@ -172,6 +172,20 @@ fn bclose_(s: &ps, span: codemap::span, indented: uint) {
|
||||
}
|
||||
fn bclose(s: &ps, span: codemap::span) { bclose_(s, span, indent_unit); }
|
||||
|
||||
fn is_begin(s: &ps) -> bool {
|
||||
alt s.s.last_token() {
|
||||
pp::BEGIN(_) { true }
|
||||
_ { false }
|
||||
}
|
||||
}
|
||||
|
||||
fn is_end(s: &ps) -> bool {
|
||||
alt s.s.last_token() {
|
||||
pp::END. { true }
|
||||
_ { false }
|
||||
}
|
||||
}
|
||||
|
||||
fn is_bol(s: &ps) -> bool {
|
||||
ret s.s.last_token() == pp::EOF ||
|
||||
s.s.last_token() == pp::hardbreak_tok();
|
||||
@ -1403,7 +1417,7 @@ fn print_comment(s: &ps, cmnt: lexer::cmnt) {
|
||||
}
|
||||
lexer::blank_line. {
|
||||
// We need to do at least one, possibly two hardbreaks.
|
||||
pprust::hardbreak_if_not_bol(s);
|
||||
if is_begin(s) || is_end(s) { hardbreak(s.s) }
|
||||
hardbreak(s.s);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-pretty
|
||||
|
||||
|
||||
// -*- rust -*-
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-pretty
|
||||
// based on:
|
||||
// http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody&lang=java
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-pretty
|
||||
/**
|
||||
A parallel word-frequency counting program.
|
||||
|
||||
|
7
src/test/pretty/empty-lines.rs
Normal file
7
src/test/pretty/empty-lines.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// Issue #759
|
||||
// Whitespace under block opening should not expand forever
|
||||
|
||||
fn a() -> uint {
|
||||
|
||||
1u
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
// xfail-pretty
|
||||
/**
|
||||
A somewhat reduced test case to expose some Valgrind issues.
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// xfail-stage0
|
||||
// xfail-pretty
|
||||
|
||||
import rusti::ivec_len;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
// xfail-stage0
|
||||
// xfail-pretty
|
||||
|
||||
use std;
|
||||
import std::ivec;
|
||||
|
@ -1,5 +1,4 @@
|
||||
// xfail-stage0
|
||||
// xfail-pretty
|
||||
// Tests that trans_path checks whether a
|
||||
// pattern-bound var is an upvar (when translating
|
||||
// the for-each body)
|
||||
|
@ -1,4 +1,3 @@
|
||||
// xfail-pretty
|
||||
|
||||
tag t { a; b(str); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user