@@ -355,6 +355,17 @@ pub mod linear {
355
355
}
356
356
}
357
357
358
+ /// Return a mutable reference to the value corresponding to the key
359
+ fn find_mut(&mut self, k: &K) -> Option<&'self mut V> {
360
+ let idx = match self.bucket_for_key(k) {
361
+ FoundEntry(idx) => idx,
362
+ TableFull | FoundHole(_) => return None
363
+ };
364
+ unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
365
+ Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
366
+ }
367
+ }
368
+
358
369
/// Insert a key-value pair into the map. An existing value for a
359
370
/// key is replaced by the new value. Return true if the key did
360
371
/// not already exist in the map.
@@ -419,17 +430,6 @@ pub mod linear {
419
430
old_value
420
431
}
421
432
422
- /// Return a mutable reference to the value corresponding to the key
423
- fn find_mut(&mut self, k: &K) -> Option<&'self mut V> {
424
- let idx = match self.bucket_for_key(k) {
425
- FoundEntry(idx) => idx,
426
- TableFull | FoundHole(_) => return None
427
- };
428
- unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
429
- Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
430
- }
431
- }
432
-
433
433
/// Return the value corresponding to the key in the map, or insert
434
434
/// and return the value if it doesn't exist.
435
435
fn find_or_insert(&mut self, k: K, v: V) -> &'self V {
0 commit comments