diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-23 08:42:21 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-30 08:54:30 -0700 |
| commit | 1d356624a1c03363be37886ffdad7dcf25ee81f6 (patch) | |
| tree | 4aef71be9e3f509b1bc8b4880e6894656e6404c4 /src/libsync/comm | |
| parent | 18a3db6aa1ce9e66b0c9cb776588d56470c6078b (diff) | |
| download | rust-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/libsync/comm')
| -rw-r--r-- | src/libsync/comm/sync.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsync/comm/sync.rs b/src/libsync/comm/sync.rs index bbb4813f5f9..42de6f66289 100644 --- a/src/libsync/comm/sync.rs +++ b/src/libsync/comm/sync.rs @@ -426,7 +426,7 @@ impl<T> Buffer<T> { fn enqueue(&mut self, t: T) { let pos = (self.start + self.size) % self.buf.len(); self.size += 1; - let prev = mem::replace(self.buf.get_mut(pos), Some(t)); + let prev = mem::replace(&mut self.buf[pos], Some(t)); assert!(prev.is_none()); } @@ -434,7 +434,7 @@ impl<T> Buffer<T> { let start = self.start; self.size -= 1; self.start = (self.start + 1) % self.buf.len(); - self.buf.get_mut(start).take().unwrap() + self.buf[start].take().unwrap() } fn size(&self) -> uint { self.size } |
