From 18115135529b9c7dd36286c9a8b6899dbb04aeeb Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 31 May 2011 09:54:18 -0700 Subject: [PATCH] Fix long lines --- src/comp/pretty/pp.rs | 10 ++++++---- src/comp/pretty/pprust.rs | 14 ++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/comp/pretty/pp.rs b/src/comp/pretty/pp.rs index 7f0004b1874..1933688c912 100644 --- a/src/comp/pretty/pp.rs +++ b/src/comp/pretty/pp.rs @@ -443,13 +443,15 @@ fn indent(int amount) { } fn print(token x, int L) { - log #fmt("print %s %d (remaining line space=%d)", tok_str(x), L, space); + log #fmt("print %s %d (remaining line space=%d)", + tok_str(x), L, space); log buf_str(token, size, left, right, 6u); alt (x) { case (BEGIN(?b)) { if (L > space) { auto col = (margin - space) + b.offset; - log #fmt("print BEGIN -> push broken block at col %d", col); + log #fmt("print BEGIN -> push broken block at col %d", + col); vec::push(print_stack, rec(offset = col, pbreak = broken(b.breaks))); @@ -491,11 +493,11 @@ fn print(token x, int L) { case (broken(inconsistent)) { if (L > space) { - log "print BREAK w/ newline in inconsistent block"; + log "print BREAK w/ newline in inconsistent"; self.print_newline(top.offset + b.offset); space = margin - (top.offset + b.offset); } else { - log "print BREAK w/o newline in inconsistent block"; + log "print BREAK w/o newline in inconsistent"; self.indent(b.blank_space); space -= b.blank_space; } diff --git a/src/comp/pretty/pprust.rs b/src/comp/pretty/pprust.rs index a3592b094cb..10940c29661 100644 --- a/src/comp/pretty/pprust.rs +++ b/src/comp/pretty/pprust.rs @@ -72,8 +72,11 @@ fn block_to_str(&ast::block blk) -> str { comments=option::none[vec[lexer::cmnt]], mutable cur_cmnt=0u, mode=mo_untyped); - cbox(s.s, indent_unit); // containing cbox, will be closed by print-block at } - ibox(s.s, 0u); // head-ibox, will be closed by print-block after { + // containing cbox, will be closed by print-block at } + cbox(s.s, indent_unit); + + // head-ibox, will be closed by print-block after { + ibox(s.s, 0u); print_block(s, blk); eof(s.s); ret writer.get_str(); @@ -657,8 +660,11 @@ fn print_opt(ps s, &option::t[@ast::expr] expr) { bclose(s, expr.span); } case (ast::expr_block(?block,_)) { - cbox(s.s, indent_unit); // containing cbox, will be closed by print-block at } - ibox(s.s, 0u); // head-box, will be closed by print-block after { + // containing cbox, will be closed by print-block at } + cbox(s.s, indent_unit); + + // head-box, will be closed by print-block after { + ibox(s.s, 0u); print_block(s, block); } case (ast::expr_assign(?lhs,?rhs,_)) {