Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
PatrickNorton and taiki-e committed Jul 20, 2022
1 parent 3419a6f commit b27e55f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crossbeam-epoch/src/atomic.rs
Expand Up @@ -836,7 +836,7 @@ impl<T: ?Sized + Pointable> Atomic<T> {
/// // any Shared or & to it ourselves, but it may be null, so we have to be careful.
/// let old = mem::replace(&mut self.ptr, Atomic::null());
/// unsafe {
/// if let Option::Some(x) = old.try_into_owned() {
/// if let Some(x) = old.try_into_owned() {
/// drop(x)
/// }
/// }
Expand All @@ -850,9 +850,9 @@ impl<T: ?Sized + Pointable> Atomic<T> {
#[cfg(not(crossbeam_loom))]
let data = self.data.into_inner();
if decompose_tag::<T>(data).0 == 0 {
Option::None
None
} else {
Option::Some(Owned::from_usize(data))
Some(Owned::from_usize(data))
}
}
}
Expand Down Expand Up @@ -1482,16 +1482,16 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// unsafe {
/// let guard = &epoch::unprotected();
/// let p = a.load(SeqCst, guard);
/// if let Option::Some(x) = p.try_into_owned() {
/// if let Some(x) = p.try_into_owned() {
/// drop(x);
/// }
/// }
/// ```
pub unsafe fn try_into_owned(self) -> Option<Owned<T>> {
if self.is_null() {
Option::None
None
} else {
Option::Some(Owned::from_usize(self.data))
Some(Owned::from_usize(self.data))
}
}

Expand Down

0 comments on commit b27e55f

Please sign in to comment.