about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-23 08:42:21 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-30 08:54:30 -0700
commit1d356624a1c03363be37886ffdad7dcf25ee81f6 (patch)
tree4aef71be9e3f509b1bc8b4880e6894656e6404c4 /src/libsyntax/ext/tt
parent18a3db6aa1ce9e66b0c9cb776588d56470c6078b (diff)
downloadrust-1d356624a1c03363be37886ffdad7dcf25ee81f6.tar.gz
rust-1d356624a1c03363be37886ffdad7dcf25ee81f6.zip
collections: Enable IndexMut for some collections
This commit enables implementations of IndexMut for a number of collections,
including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same
time this deprecates the `get_mut` methods on vectors in favor of using the
indexing notation.

cc #18424
Diffstat (limited to 'src/libsyntax/ext/tt')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 9260a45adb9..4de20420148 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -288,8 +288,7 @@ pub fn parse(sess: &ParseSess,
                         // Only touch the binders we have actually bound
                         for idx in range(ei.match_lo, ei.match_hi) {
                             let sub = (ei.matches[idx]).clone();
-                            new_pos.matches
-                                   .get_mut(idx)
+                            new_pos.matches[idx]
                                    .push(Rc::new(MatchedSeq(sub, mk_sp(ei.sp_lo,
                                                                        sp.hi))));
                         }
@@ -331,8 +330,7 @@ pub fn parse(sess: &ParseSess,
                         new_ei.idx += 1u;
                         //we specifically matched zero repeats.
                         for idx in range(match_idx_lo, match_idx_hi) {
-                            new_ei.matches
-                                  .get_mut(idx)
+                            new_ei.matches[idx]
                                   .push(Rc::new(MatchedSeq(Vec::new(), sp)));
                         }
 
@@ -376,7 +374,7 @@ pub fn parse(sess: &ParseSess,
         if token_name_eq(&tok, &token::Eof) {
             if eof_eis.len() == 1u {
                 let mut v = Vec::new();
-                for dv in eof_eis.get_mut(0).matches.iter_mut() {
+                for dv in eof_eis[0].matches.iter_mut() {
                     v.push(dv.pop().unwrap());
                 }
                 return Success(nameize(sess, ms, v.as_slice()));
@@ -417,7 +415,7 @@ pub fn parse(sess: &ParseSess,
                 match ei.elts[ei.idx].node {
                   MatchNonterminal(_, name, idx) => {
                     let name_string = token::get_ident(name);
-                    ei.matches.get_mut(idx).push(Rc::new(MatchedNonterminal(
+                    ei.matches[idx].push(Rc::new(MatchedNonterminal(
                         parse_nt(&mut rust_parser, name_string.get()))));
                     ei.idx += 1u;
                   }