1
Fork 0

Add #[must_use] to non-mutating verb methods

This commit is contained in:
John Kugelman 2021-10-11 20:40:03 -04:00
parent 5b210643eb
commit c3f0577002
4 changed files with 15 additions and 1 deletions

View file

@ -2229,6 +2229,8 @@ impl<T: ?Sized> Weak<T> {
///
/// assert!(weak_five.upgrade().is_none());
/// ```
#[must_use = "this returns a new `Rc`, \
without modifying the original weak pointer"]
#[stable(feature = "rc_weak", since = "1.4.0")]
pub fn upgrade(&self) -> Option<Rc<T>> {
let inner = self.inner()?;