Rollup merge of #89796 - jkugelman:must-use-non-mutating-verb-methods, r=joshtriplett
Add #[must_use] to non-mutating verb methods These are methods that could be misconstrued to mutate their input, similar to #89694. I gave each one a different custom message. I wrote that `upgrade` and `downgrade` don't modify the input pointers. Logically they don't, but technically they do... Parent issue: #89692 r? ```@joshtriplett```
This commit is contained in:
commit
a1bdd48106
4 changed files with 15 additions and 1 deletions
|
@ -2230,6 +2230,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()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue