Skip to content

Commit 406ebb7

Browse files
committed
Remove unwrap_unchecked in favor of unwrap
1 parent 91c36ed commit 406ebb7

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/raw/mod.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,6 @@ fn h2(hash: u64) -> u8 {
155155
(top7 & 0x7f) as u8 // truncation
156156
}
157157

158-
/// Returns the contained [`Some`] value, consuming the `this` value,
159-
/// without checking that the value is not [`None`].
160-
///
161-
/// # Safety
162-
///
163-
/// Calling this method on [`None`] is *[undefined behavior]*.
164-
#[inline]
165-
pub unsafe fn unwrap_unchecked<T>(this: Option<T>) -> T {
166-
debug_assert!(this.is_some());
167-
match this {
168-
Some(val) => val,
169-
// SAFETY: the safety contract must be upheld by the caller.
170-
None => hint::unreachable_unchecked(),
171-
}
172-
}
173-
174158
/// Probe sequence based on triangular numbers, which is guaranteed (since our
175159
/// table size is a power of two) to visit every group of elements exactly once.
176160
///
@@ -975,8 +959,7 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
975959
let bit = group.match_empty_or_deleted().lowest_set_bit();
976960

977961
if likely(bit.is_some()) {
978-
let mut index =
979-
(probe_seq.pos + unwrap_unchecked(bit)) & self.table.bucket_mask;
962+
let mut index = (probe_seq.pos + bit.unwrap()) & self.table.bucket_mask;
980963

981964
// In tables smaller than the group width, trailing control
982965
// bytes outside the range of the table are filled with

0 commit comments

Comments
 (0)