about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-07-27 21:20:51 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-07-27 21:20:51 +0200
commit0186176ae989cc5ccce1cf90322c567eee084dbf (patch)
tree7bf58fd12b8c3fb3eee00b3919f854d7cc5d5142 /src/comp/syntax
parenta4cf804671761f05445d71510a730563f07fde84 (diff)
downloadrust-0186176ae989cc5ccce1cf90322c567eee084dbf.tar.gz
rust-0186176ae989cc5ccce1cf90322c567eee084dbf.zip
Stop outputting spurious spaces in ivec types and empty mutable vecs
(in the pretty-printer)
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/print/pprust.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 80f691f5a9c..92510af42cf 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -286,7 +286,11 @@ fn print_type(s: &ps, ty: &ast::ty) {
         print_type(s, *mt.ty);
         if parens { pclose(s); }
         word(s.s, "[");
-        print_mutability(s, mt.mut);
+        alt mt.mut {
+          ast::mut. { word(s.s, "mutable"); }
+          ast::maybe_mut. { word(s.s, "mutable?"); }
+          ast::imm. {}
+        }
         word(s.s, "]");
       }
       ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); }
@@ -673,7 +677,10 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
           ast::sk_rc. { word(s.s, "["); }
           ast::sk_unique. { word(s.s, "~["); }
         }
-        if mut == ast::mut { word_nbsp(s, "mutable"); }
+        if mut == ast::mut {
+            word(s.s, "mutable");
+            if ivec::len(exprs) > 0u { nbsp(s); }
+        }
         commasep_exprs(s, inconsistent, exprs);
         word(s.s, "]");
         end(s);