This commit is contained in:
Matthew Giordano 2024-08-29 12:32:33 -07:00
parent 13e36cf887
commit 21cb84763c

View File

@ -1710,11 +1710,7 @@ impl<T: ?Sized, A: Allocator> Rc<T, A> {
#[inline]
#[stable(feature = "rc_unique", since = "1.4.0")]
pub fn get_mut(this: &mut Self) -> Option<&mut T> {
if Rc::is_unique(this) {
unsafe { Some(Rc::get_mut_unchecked(this)) }
} else {
None
}
if Rc::is_unique(this) { unsafe { Some(Rc::get_mut_unchecked(this)) } } else { None }
}
/// Returns a mutable reference into the given `Rc`,
@ -3291,11 +3287,7 @@ impl<T: ?Sized, A: Allocator> Weak<T, A> {
#[must_use]
#[stable(feature = "weak_counts", since = "1.41.0")]
pub fn strong_count(&self) -> usize {
if let Some(inner) = self.inner() {
inner.strong()
} else {
0
}
if let Some(inner) = self.inner() { inner.strong() } else { 0 }
}
/// Gets the number of `Weak` pointers pointing to this allocation.