Skip to content

Commit 634c503

Browse files
authored
Merge pull request #107 from bluss/take-back-deprecation-warnings
Remove deprecation warnings on the removal methods again
2 parents 05c26ce + 268665b commit 634c503

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/map.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,9 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
664664
replace(self.get_mut(), value)
665665
}
666666

667-
#[deprecated(note = "use `swap_remove` or `shift_remove`")]
667+
/// Remove the key, value pair stored in the map for this entry, and return the value.
668+
///
669+
/// **NOTE:** This is equivalent to `.swap_remove()`.
668670
pub fn remove(self) -> V {
669671
self.swap_remove()
670672
}
@@ -692,7 +694,8 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
692694
}
693695

694696
/// Remove and return the key, value pair stored in the map for this entry
695-
#[deprecated(note = "use `swap_remove_entry` or `shift_remove_entry`")]
697+
///
698+
/// **NOTE:** This is equivalent to `.swap_remove_entry()`.
696699
pub fn remove_entry(self) -> (K, V) {
697700
self.swap_remove_entry()
698701
}
@@ -998,10 +1001,14 @@ impl<K, V, S> IndexMap<K, V, S>
9981001
self.core.find_using(h, move |entry| { Q::equivalent(key, &entry.key) })
9991002
}
10001003

1001-
/// NOTE: Same as .swap_remove
1004+
/// Remove the key-value pair equivalent to `key` and return
1005+
/// its value.
1006+
///
1007+
/// **NOTE:** This is equivalent to `.swap_remove(key)`, if you need to
1008+
/// preserve the order of the keys in the map, use `.shift_remove(key)`
1009+
/// instead.
10021010
///
10031011
/// Computes in **O(1)** time (average).
1004-
#[deprecated(note = "use `swap_remove`")]
10051012
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
10061013
where Q: Hash + Equivalent<K>,
10071014
{

src/set.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,12 @@ impl<T, S> IndexSet<T, S>
306306
}
307307
}
308308

309-
/// FIXME Same as .swap_remove
309+
/// Remove the value from the set, and return `true` if it was present.
310+
///
311+
/// **NOTE:** This is equivalent to `.swap_remove(value)`, if you want
312+
/// to preserve the order of the values in the set, use `.shift_remove(value)`.
310313
///
311314
/// Computes in **O(1)** time (average).
312-
#[deprecated(note = "use `swap_remove` or `shift_remove`")]
313315
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
314316
where Q: Hash + Equivalent<T>,
315317
{
@@ -346,10 +348,14 @@ impl<T, S> IndexSet<T, S>
346348
self.map.shift_remove(value).is_some()
347349
}
348350

349-
/// FIXME Same as .swap_take
351+
/// Removes and returns the value in the set, if any, that is equal to the
352+
/// given one.
353+
///
354+
/// **NOTE:** This is equivalent to `.swap_take(value)`, if you need to
355+
/// preserve the order of the values in the set, use `.shift_take(value)`
356+
/// instead.
350357
///
351358
/// Computes in **O(1)** time (average).
352-
#[deprecated(note = "use `swap_take` or `shift_take`")]
353359
pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T>
354360
where Q: Hash + Equivalent<T>,
355361
{

0 commit comments

Comments
 (0)