Skip to content

Commit f6e1835

Browse files
committed
Auto merge of #464 - JustForFun88:change_ref_to_mut_ref, r=Amanieu
Change `&` to `&mut` where applicable This addresses #451 (comment). All remaining functions either return raw pointers or do nothing with the data on the heap.
2 parents 84b782d + 039a9fb commit f6e1835

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/raw/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
17831783
/// [`RawTableInner::ctrl`]: RawTableInner::ctrl
17841784
/// [`RawTableInner::set_ctrl_h2`]: RawTableInner::set_ctrl_h2
17851785
#[inline]
1786-
unsafe fn prepare_insert_slot(&self, hash: u64) -> (usize, u8) {
1786+
unsafe fn prepare_insert_slot(&mut self, hash: u64) -> (usize, u8) {
17871787
let index: usize = self.find_insert_slot(hash).index;
17881788
// SAFETY:
17891789
// 1. The `find_insert_slot` function either returns an `index` less than or
@@ -2054,7 +2054,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
20542054
/// [`Bucket::as_ptr`]: Bucket::as_ptr
20552055
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
20562056
#[inline]
2057-
unsafe fn set_ctrl_h2(&self, index: usize, hash: u64) {
2057+
unsafe fn set_ctrl_h2(&mut self, index: usize, hash: u64) {
20582058
// SAFETY: The caller must uphold the safety rules for the [`RawTableInner::set_ctrl_h2`]
20592059
self.set_ctrl(index, h2(hash));
20602060
}
@@ -2088,7 +2088,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
20882088
/// [`Bucket::as_ptr`]: Bucket::as_ptr
20892089
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
20902090
#[inline]
2091-
unsafe fn replace_ctrl_h2(&self, index: usize, hash: u64) -> u8 {
2091+
unsafe fn replace_ctrl_h2(&mut self, index: usize, hash: u64) -> u8 {
20922092
// SAFETY: The caller must uphold the safety rules for the [`RawTableInner::replace_ctrl_h2`]
20932093
let prev_ctrl = *self.ctrl(index);
20942094
self.set_ctrl_h2(index, hash);
@@ -2120,7 +2120,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
21202120
/// [`Bucket::as_ptr`]: Bucket::as_ptr
21212121
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
21222122
#[inline]
2123-
unsafe fn set_ctrl(&self, index: usize, ctrl: u8) {
2123+
unsafe fn set_ctrl(&mut self, index: usize, ctrl: u8) {
21242124
// Replicate the first Group::WIDTH control bytes at the end of
21252125
// the array without using a branch. If the tables smaller than
21262126
// the group width (self.buckets() < Group::WIDTH),
@@ -2909,7 +2909,7 @@ impl<T: Clone, A: Allocator + Clone> RawTable<T, A> {
29092909
{
29102910
self.clear();
29112911

2912-
let guard_self = guard(&mut *self, |self_| {
2912+
let mut guard_self = guard(&mut *self, |self_| {
29132913
// Clear the partially copied table if a panic occurs, otherwise
29142914
// items and growth_left will be out of sync with the contents
29152915
// of the table.

0 commit comments

Comments
 (0)