]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/tt/macro_parser.rs
rollup merge of #21830: japaric/for-cleanup
[rust.git] / src / libsyntax / ext / tt / macro_parser.rs
index 0eec182e0fc66d5fbcd4b662a5277839b4333a7c..823efdd3eed225362d1f46ac3ab6a47a1dad22fa 100644 (file)
@@ -171,11 +171,11 @@ pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: ByteP
         stack: vec![],
         top_elts: TtSeq(ms),
         sep: sep,
-        idx: 0us,
+        idx: 0,
         up: None,
         matches: matches,
-        match_lo: 0us,
-        match_cur: 0us,
+        match_lo: 0,
+        match_cur: 0,
         match_hi: match_idx_hi,
         sp_lo: lo
     }
@@ -238,7 +238,7 @@ fn n_rec(p_s: &ParseSess, m: &TokenTree, res: &[Rc<NamedMatch>],
         }
     }
     let mut ret_val = HashMap::new();
-    let mut idx = 0us;
+    let mut idx = 0;
     for m in ms { n_rec(p_s, m, res, &mut ret_val, &mut idx) }
     ret_val
 }
@@ -383,7 +383,7 @@ pub fn parse(sess: &ParseSess,
                         if seq.op == ast::ZeroOrMore {
                             let mut new_ei = ei.clone();
                             new_ei.match_cur += seq.num_captures;
-                            new_ei.idx += 1us;
+                            new_ei.idx += 1;
                             //we specifically matched zero repeats.
                             for idx in ei.match_cur..ei.match_cur + seq.num_captures {
                                 (&mut new_ei.matches[idx]).push(Rc::new(MatchedSeq(vec![], sp)));
@@ -398,7 +398,7 @@ pub fn parse(sess: &ParseSess,
                         cur_eis.push(box MatcherPos {
                             stack: vec![],
                             sep: seq.separator.clone(),
-                            idx: 0us,
+                            idx: 0,
                             matches: matches,
                             match_lo: ei_t.match_cur,
                             match_cur: ei_t.match_cur,
@@ -442,20 +442,20 @@ pub fn parse(sess: &ParseSess,
 
         /* error messages here could be improved with links to orig. rules */
         if token_name_eq(&tok, &token::Eof) {
-            if eof_eis.len() == 1us {
+            if eof_eis.len() == 1 {
                 let mut v = Vec::new();
                 for dv in &mut (&mut eof_eis[0]).matches {
                     v.push(dv.pop().unwrap());
                 }
                 return Success(nameize(sess, ms, &v[]));
-            } else if eof_eis.len() > 1us {
+            } else if eof_eis.len() > 1 {
                 return Error(sp, "ambiguity: multiple successful parses".to_string());
             } else {
                 return Failure(sp, "unexpected end of macro invocation".to_string());
             }
         } else {
-            if (bb_eis.len() > 0us && next_eis.len() > 0us)
-                || bb_eis.len() > 1us {
+            if (bb_eis.len() > 0 && next_eis.len() > 0)
+                || bb_eis.len() > 1 {
                 let nts = bb_eis.iter().map(|ei| {
                     match ei.top_elts.get_tt(ei.idx) {
                       TtToken(_, MatchNt(bind, name, _, _)) => {
@@ -469,12 +469,12 @@ pub fn parse(sess: &ParseSess,
                     "local ambiguity: multiple parsing options: \
                      built-in NTs {} or {} other options.",
                     nts, next_eis.len()).to_string());
-            } else if bb_eis.len() == 0us && next_eis.len() == 0us {
+            } else if bb_eis.len() == 0 && next_eis.len() == 0 {
                 return Failure(sp, format!("no rules expected the token `{}`",
                             pprust::token_to_string(&tok)).to_string());
-            } else if next_eis.len() > 0us {
+            } else if next_eis.len() > 0 {
                 /* Now process the next token */
-                while next_eis.len() > 0us {
+                while next_eis.len() > 0 {
                     cur_eis.push(next_eis.pop().unwrap());
                 }
                 rdr.next_token();
@@ -488,7 +488,7 @@ pub fn parse(sess: &ParseSess,
                     let match_cur = ei.match_cur;
                     (&mut ei.matches[match_cur]).push(Rc::new(MatchedNonterminal(
                         parse_nt(&mut rust_parser, span, name_string.get()))));
-                    ei.idx += 1us;
+                    ei.idx += 1;
                     ei.match_cur += 1;
                   }
                   _ => panic!()
@@ -501,16 +501,16 @@ pub fn parse(sess: &ParseSess,
             }
         }
 
-        assert!(cur_eis.len() > 0us);
+        assert!(cur_eis.len() > 0);
     }
 }
 
 pub fn parse_nt(p: &mut Parser, sp: Span, name: &str) -> Nonterminal {
     match name {
         "tt" => {
-            p.quote_depth += 1us; //but in theory, non-quoted tts might be useful
+            p.quote_depth += 1; //but in theory, non-quoted tts might be useful
             let res = token::NtTT(P(p.parse_token_tree()));
-            p.quote_depth -= 1us;
+            p.quote_depth -= 1;
             return res;
         }
         _ => {}