summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2013-05-09 13:27:24 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2013-05-11 20:36:44 -0700
commited4186446492e141a4dc37829dc9599133d00dd0 (patch)
treeb26e12beb4abead4e7dd3c0834c5e055a1fba478 /src/libsyntax
parentf2f10bdc7a2f1d1501abb04f3625356c0c251d92 (diff)
downloadrust-ed4186446492e141a4dc37829dc9599133d00dd0.tar.gz
rust-ed4186446492e141a4dc37829dc9599133d00dd0.zip
Warning police
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs2
-rw-r--r--src/libsyntax/ext/pipes/mod.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs4
-rw-r--r--src/libsyntax/parse/comments.rs11
4 files changed, 8 insertions, 11 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 5129fa6ebd2..0fe28dadbc7 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -27,7 +27,6 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
                    fld: @ast_fold,
                    orig: @fn(&expr_, span, @ast_fold) -> (expr_, span))
                 -> (expr_, span) {
-    let mut cx = cx;
     match *e {
         // expr_mac should really be expr_ext or something; it's the
         // entry-point for all syntax extensions.
@@ -113,7 +112,6 @@ pub fn expand_mod_items(extsbox: @mut SyntaxEnv,
                         fld: @ast_fold,
                         orig: @fn(&ast::_mod, @ast_fold) -> ast::_mod)
                      -> ast::_mod {
-    let mut cx = cx;
 
     // Fold the contents first:
     let module_ = orig(module_, fld);
diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs
index 85c578bc2ce..642f22e9736 100644
--- a/src/libsyntax/ext/pipes/mod.rs
+++ b/src/libsyntax/ext/pipes/mod.rs
@@ -74,7 +74,7 @@ pub fn expand_proto(cx: @ext_ctxt, _sp: span, id: ast::ident,
     let rdr = tt_rdr as @reader;
     let rust_parser = Parser(sess, cfg, rdr.dup());
 
-    let mut proto = rust_parser.parse_proto(cx.str_of(id));
+    let proto = rust_parser.parse_proto(cx.str_of(id));
 
     // check for errors
     visit(proto, cx);
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 0c1e619985d..46b09aca8b2 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -247,8 +247,8 @@ pub fn parse(
         let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
 
         /* we append new items to this while we go */
-        while cur_eis.len() > 0u { /* for each Earley Item */
-            let mut ei = cur_eis.pop();
+        while !cur_eis.is_empty() { /* for each Earley Item */
+            let ei = cur_eis.pop();
 
             let idx = ei.idx;
             let len = ei.elts.len();
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs
index 4e29c3dcf18..acfd18c74de 100644
--- a/src/libsyntax/parse/comments.rs
+++ b/src/libsyntax/parse/comments.rs
@@ -202,15 +202,14 @@ fn all_whitespace(s: ~str, begin: uint, end: uint) -> bool {
 
 fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
                                         s: ~str, col: CharPos) {
-    let mut s1;
-    let len = str::len(s);
+    let len = s.len();
     // FIXME #3961: Doing bytewise comparison and slicing with CharPos
     let col = col.to_uint();
-    if all_whitespace(s, 0u, uint::min(len, col)) {
+    let s1 = if all_whitespace(s, 0, uint::min(len, col)) {
         if col < len {
-            s1 = str::slice(s, col, len).to_owned();
-        } else { s1 = ~""; }
-    } else { s1 = s; }
+            str::slice(s, col, len).to_owned()
+        } else {  ~"" }
+    } else { s };
     debug!("pushing line: %s", s1);
     lines.push(s1);
 }