summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-04-12 01:10:31 -0400
committerAlex Crichton <alex@alexcrichton.com>2013-04-20 21:03:24 -0400
commitfd97cac251224e936508541e99fb63ac02fe6eca (patch)
tree2060b9ee3c146637e30843a14ed7b463acdff7fa /src/libsyntax/ext
parent7d317fe7e584832f4aac113d3d5d19d90536c081 (diff)
downloadrust-fd97cac251224e936508541e99fb63ac02fe6eca.tar.gz
rust-fd97cac251224e936508541e99fb63ac02fe6eca.zip
syntax: remove unused 'mut' variables
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/fmt.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 3ebe844950a..6a877040f48 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -96,7 +96,7 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
             }
         }
         fn make_ty(cx: @ext_ctxt, sp: span, t: Ty) -> @ast::expr {
-            let mut rt_type;
+            let rt_type;
             match t {
               TyHex(c) => match c {
                 CaseUpper => rt_type = ~"TyHexUpper",
@@ -272,6 +272,7 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
     /* Translate each piece (portion of the fmt expression) by invoking the
        corresponding function in core::unstable::extfmt. Each function takes a
        buffer to insert data into along with the data being formatted. */
+    let npieces = pieces.len();
     do vec::consume(pieces) |i, pc| {
         match pc {
             /* Raw strings get appended via str::push_str */
@@ -279,9 +280,10 @@ fn pieces_to_expr(cx: @ext_ctxt, sp: span,
                 let portion = mk_uniq_str(cx, fmt_sp, s);
 
                 /* If this is the first portion, then initialize the local
-                   buffer with it directly */
+                   buffer with it directly. If it's actually the only piece,
+                   then there's no need for it to be mutable */
                 if i == 0 {
-                    stms.push(mk_local(cx, fmt_sp, true, ident, portion));
+                    stms.push(mk_local(cx, fmt_sp, npieces > 1, ident, portion));
                 } else {
                     let args = ~[mk_mut_addr_of(cx, fmt_sp, buf()), portion];
                     let call = mk_call_global(cx,