From 797cd9fd0ec2a27d4a755d8b22419912f1353bd3 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Tue, 26 Jul 2011 16:28:16 -0700 Subject: [PATCH] Try to keep the local and its type together when wrapping a long decl. --- src/comp/syntax/print/pprust.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index fb27b2ebd1ae..f5cf6ba1072e 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1056,13 +1056,17 @@ fn print_decl(&ps s, &@ast::decl decl) { ibox(s, indent_unit); word_nbsp(s, "let"); fn print_local(&ps s, &@ast::local loc) { - word(s.s, loc.node.ident); - alt (loc.node.ty) { + alt loc.node.ty { some(?ty) { + ibox(s, indent_unit); + word(s.s, loc.node.ident); word_space(s, ":"); print_type(s, *ty); + end(s); + } + _ { + word(s.s, loc.node.ident); } - _ {} } alt loc.node.init { some(?init) {