Skip to content

Commit

Permalink
Changed function signature of get_mut_unchecked to use &mut self
Browse files Browse the repository at this point in the history
  • Loading branch information
dynos01 committed Jun 4, 2023
1 parent 0e48741 commit e2a1e21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/imp_pl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<T> OnceCell<T> {
///
/// Caller must ensure that the cell is in initialized state, and that
/// the contents are acquired by (synchronized to) this thread.
pub(crate) unsafe fn get_mut_unchecked(&self) -> &mut T {
pub(crate) unsafe fn get_mut_unchecked(&mut self) -> &mut T {
debug_assert!(self.is_initialized());
let slot = &mut *self.value.get();
crate::unwrap_unchecked(slot.as_mut())
Expand Down
2 changes: 1 addition & 1 deletion src/imp_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl<T> OnceCell<T> {
/// Caller must ensure that the cell is in initialized state, and that
/// the contents are acquired by (synchronized to) this thread.
#[cfg(not(feature = "critical_section"))]
pub(crate) unsafe fn get_mut_unchecked(&self) -> &mut T {
pub(crate) unsafe fn get_mut_unchecked(&mut self) -> &mut T {
debug_assert!(self.is_initialized());
let slot = &mut *self.value.get();
crate::unwrap_unchecked(slot.as_mut())
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ pub mod sync {
/// the contents are acquired by (synchronized to) this thread.
#[inline]
#[cfg(not(feature = "critical_section"))]
pub unsafe fn get_mut_unchecked(&self) -> &mut T {
pub unsafe fn get_mut_unchecked(&mut self) -> &mut T {
self.0.get_mut_unchecked()
}

Expand Down

0 comments on commit e2a1e21

Please sign in to comment.