Add #[must_use] to remaining alloc functions
This commit is contained in:
parent
e1e9319d93
commit
fb2d0f5c03
15 changed files with 78 additions and 23 deletions
|
@ -2246,6 +2246,7 @@ impl<T: ?Sized> Weak<T> {
|
|||
/// Gets the number of strong (`Rc`) pointers pointing to this allocation.
|
||||
///
|
||||
/// If `self` was created using [`Weak::new`], this will return 0.
|
||||
#[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 }
|
||||
|
@ -2254,6 +2255,7 @@ impl<T: ?Sized> Weak<T> {
|
|||
/// Gets the number of `Weak` pointers pointing to this allocation.
|
||||
///
|
||||
/// If no strong pointers remain, this will return zero.
|
||||
#[must_use]
|
||||
#[stable(feature = "weak_counts", since = "1.41.0")]
|
||||
pub fn weak_count(&self) -> usize {
|
||||
self.inner()
|
||||
|
@ -2324,6 +2326,7 @@ impl<T: ?Sized> Weak<T> {
|
|||
/// assert!(!first.ptr_eq(&third));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "weak_ptr_eq", since = "1.39.0")]
|
||||
pub fn ptr_eq(&self, other: &Self) -> bool {
|
||||
self.ptr.as_ptr() == other.ptr.as_ptr()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue