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

@ -424,10 +424,10 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+PartialEq+PartialOrd+Float+
// or set to 0 if max and carry the 1.
let current_digit = ascii2value(buf[i as uint]);
if current_digit < (radix - 1) {
*buf.get_mut(i as uint) = value2ascii(current_digit+1);
buf[i as uint] = value2ascii(current_digit+1);
break;
} else {
*buf.get_mut(i as uint) = value2ascii(0);
buf[i as uint] = value2ascii(0);
i -= 1;
}
}