Skip to content

Change & to &mut where applicable #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1783,7 +1783,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
/// [`RawTableInner::ctrl`]: RawTableInner::ctrl
/// [`RawTableInner::set_ctrl_h2`]: RawTableInner::set_ctrl_h2
#[inline]
unsafe fn prepare_insert_slot(&self, hash: u64) -> (usize, u8) {
unsafe fn prepare_insert_slot(&mut self, hash: u64) -> (usize, u8) {
let index: usize = self.find_insert_slot(hash).index;
// SAFETY:
// 1. The `find_insert_slot` function either returns an `index` less than or
Expand Down Expand Up @@ -2054,7 +2054,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
/// [`Bucket::as_ptr`]: Bucket::as_ptr
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[inline]
unsafe fn set_ctrl_h2(&self, index: usize, hash: u64) {
unsafe fn set_ctrl_h2(&mut self, index: usize, hash: u64) {
// SAFETY: The caller must uphold the safety rules for the [`RawTableInner::set_ctrl_h2`]
self.set_ctrl(index, h2(hash));
}
Expand Down Expand Up @@ -2088,7 +2088,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
/// [`Bucket::as_ptr`]: Bucket::as_ptr
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[inline]
unsafe fn replace_ctrl_h2(&self, index: usize, hash: u64) -> u8 {
unsafe fn replace_ctrl_h2(&mut self, index: usize, hash: u64) -> u8 {
// SAFETY: The caller must uphold the safety rules for the [`RawTableInner::replace_ctrl_h2`]
let prev_ctrl = *self.ctrl(index);
self.set_ctrl_h2(index, hash);
Expand Down Expand Up @@ -2120,7 +2120,7 @@ impl<A: Allocator + Clone> RawTableInner<A> {
/// [`Bucket::as_ptr`]: Bucket::as_ptr
/// [`undefined behavior`]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
#[inline]
unsafe fn set_ctrl(&self, index: usize, ctrl: u8) {
unsafe fn set_ctrl(&mut self, index: usize, ctrl: u8) {
// Replicate the first Group::WIDTH control bytes at the end of
// the array without using a branch. If the tables smaller than
// the group width (self.buckets() < Group::WIDTH),
Expand Down Expand Up @@ -2909,7 +2909,7 @@ impl<T: Clone, A: Allocator + Clone> RawTable<T, A> {
{
self.clear();

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