1
Fork 0

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
This commit is contained in:
Alex Crichton 2014-10-23 08:42:21 -07:00
parent 18a3db6aa1
commit 1d356624a1
46 changed files with 165 additions and 271 deletions

View file

@ -1231,7 +1231,7 @@ impl Stack {
InternalIndex(i) => { i + 1 }
_ => { panic!(); }
};
*self.stack.get_mut(len - 1) = InternalIndex(idx);
self.stack[len - 1] = InternalIndex(idx);
}
}