Skip to content

Commit 3263559

Browse files
committed
Remove Bucket and RawTable that are hard to use safely
This removes the following methods in favor of better alternatives: - `RawTable::erase_no_drop` => Use `RawTable::erase` or `RawTable::remove` instead. - `Bucket::read` => Use `RawTable::remove` instead. - `Bucket::drop` => Use `RawTable::erase` instead. - `Bucket::write` => Use `Bucket::as_mut` instead.
1 parent bf272b6 commit 3263559

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/raw/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -340,15 +340,15 @@ impl<T> Bucket<T> {
340340
}
341341
}
342342
#[cfg_attr(feature = "inline-more", inline)]
343-
pub unsafe fn drop(&self) {
343+
pub(crate) unsafe fn drop(&self) {
344344
self.as_ptr().drop_in_place();
345345
}
346346
#[inline]
347-
pub unsafe fn read(&self) -> T {
347+
pub(crate) unsafe fn read(&self) -> T {
348348
self.as_ptr().read()
349349
}
350350
#[inline]
351-
pub unsafe fn write(&self, val: T) {
351+
pub(crate) unsafe fn write(&self, val: T) {
352352
self.as_ptr().write(val);
353353
}
354354
#[inline]
@@ -550,16 +550,14 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
550550

551551
/// Erases an element from the table without dropping it.
552552
#[cfg_attr(feature = "inline-more", inline)]
553-
#[deprecated(since = "0.8.1", note = "use erase or remove instead")]
554-
pub unsafe fn erase_no_drop(&mut self, item: &Bucket<T>) {
553+
unsafe fn erase_no_drop(&mut self, item: &Bucket<T>) {
555554
let index = self.bucket_index(item);
556555
self.table.erase(index);
557556
}
558557

559558
/// Erases an element from the table, dropping it in place.
560559
#[cfg_attr(feature = "inline-more", inline)]
561560
#[allow(clippy::needless_pass_by_value)]
562-
#[allow(deprecated)]
563561
pub unsafe fn erase(&mut self, item: Bucket<T>) {
564562
// Erase the element from the table first since drop might panic.
565563
self.erase_no_drop(&item);
@@ -585,7 +583,6 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
585583
/// Removes an element from the table, returning it.
586584
#[cfg_attr(feature = "inline-more", inline)]
587585
#[allow(clippy::needless_pass_by_value)]
588-
#[allow(deprecated)]
589586
pub unsafe fn remove(&mut self, item: Bucket<T>) -> T {
590587
self.erase_no_drop(&item);
591588
item.read()

0 commit comments

Comments
 (0)