Skip to content

Commit 731dfcc

Browse files
committed
Also remove deprecated methods from RustcEntry
This mirrors the changes done in the main hashbrown API.
1 parent 8f41ed4 commit 731dfcc

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

src/rustc_entry.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ where
3535
let hash = make_hash(&self.hash_builder, &key);
3636
if let Some(elem) = self.table.find(hash, |q| q.0.eq(&key)) {
3737
RustcEntry::Occupied(RustcOccupiedEntry {
38-
key: Some(key),
3938
elem,
4039
table: &mut self.table,
4140
})
@@ -88,7 +87,6 @@ pub struct RustcOccupiedEntry<'a, K, V, A = Global>
8887
where
8988
A: Allocator,
9089
{
91-
key: Option<K>,
9290
elem: Bucket<(K, V)>,
9391
table: &'a mut RawTable<(K, V), A>,
9492
}
@@ -456,66 +454,6 @@ impl<'a, K, V, A: Allocator> RustcOccupiedEntry<'a, K, V, A> {
456454
pub fn remove(self) -> V {
457455
self.remove_entry().1
458456
}
459-
460-
/// Replaces the entry, returning the old key and value. The new key in the hash map will be
461-
/// the key used to create this entry.
462-
///
463-
/// # Examples
464-
///
465-
/// ```
466-
/// use hashbrown::hash_map::{RustcEntry, HashMap};
467-
/// use std::rc::Rc;
468-
///
469-
/// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
470-
/// map.insert(Rc::new("Stringthing".to_string()), 15);
471-
///
472-
/// let my_key = Rc::new("Stringthing".to_string());
473-
///
474-
/// if let RustcEntry::Occupied(entry) = map.rustc_entry(my_key) {
475-
/// // Also replace the key with a handle to our other key.
476-
/// let (old_key, old_value): (Rc<String>, u32) = entry.replace_entry(16);
477-
/// }
478-
///
479-
/// ```
480-
#[cfg_attr(feature = "inline-more", inline)]
481-
pub fn replace_entry(self, value: V) -> (K, V) {
482-
let entry = unsafe { self.elem.as_mut() };
483-
484-
let old_key = mem::replace(&mut entry.0, self.key.unwrap());
485-
let old_value = mem::replace(&mut entry.1, value);
486-
487-
(old_key, old_value)
488-
}
489-
490-
/// Replaces the key in the hash map with the key used to create this entry.
491-
///
492-
/// # Examples
493-
///
494-
/// ```
495-
/// use hashbrown::hash_map::{RustcEntry, HashMap};
496-
/// use std::rc::Rc;
497-
///
498-
/// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
499-
/// let mut known_strings: Vec<Rc<String>> = Vec::new();
500-
///
501-
/// // Initialise known strings, run program, etc.
502-
///
503-
/// reclaim_memory(&mut map, &known_strings);
504-
///
505-
/// fn reclaim_memory(map: &mut HashMap<Rc<String>, u32>, known_strings: &[Rc<String>] ) {
506-
/// for s in known_strings {
507-
/// if let RustcEntry::Occupied(entry) = map.rustc_entry(s.clone()) {
508-
/// // Replaces the entry's key with our version of it in `known_strings`.
509-
/// entry.replace_key();
510-
/// }
511-
/// }
512-
/// }
513-
/// ```
514-
#[cfg_attr(feature = "inline-more", inline)]
515-
pub fn replace_key(self) -> K {
516-
let entry = unsafe { self.elem.as_mut() };
517-
mem::replace(&mut entry.0, self.key.unwrap())
518-
}
519457
}
520458

521459
impl<'a, K, V, A: Allocator> RustcVacantEntry<'a, K, V, A> {
@@ -598,7 +536,6 @@ impl<'a, K, V, A: Allocator> RustcVacantEntry<'a, K, V, A> {
598536
pub fn insert_entry(self, value: V) -> RustcOccupiedEntry<'a, K, V, A> {
599537
let bucket = unsafe { self.table.insert_no_grow(self.hash, (self.key, value)) };
600538
RustcOccupiedEntry {
601-
key: None,
602539
elem: bucket,
603540
table: self.table,
604541
}

0 commit comments

Comments
 (0)