diff options
| author | Zack M. Davis <code@zackmdavis.net> | 2018-10-11 23:10:37 -0700 |
|---|---|---|
| committer | Zack M. Davis <code@zackmdavis.net> | 2018-10-12 22:01:43 -0700 |
| commit | ab91a6b4df04a60cf19682b1f016848d3e4784ad (patch) | |
| tree | 10fd45f1eaf3b09a4b84b5f1c8154e46d2334042 /src/liballoc | |
| parent | c47785f6beb7f2047b2915c42d1d3d4c0ab0abf0 (diff) | |
| download | rust-ab91a6b4df04a60cf19682b1f016848d3e4784ad.tar.gz rust-ab91a6b4df04a60cf19682b1f016848d3e4784ad.zip | |
`#[must_use]` for associated functions is supposed to actually work
In the comments of (closed, defunct) pull request #54884, Mazdak "Centril" Farrokhzad noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for self-ful methods have always worked—but documenting or reworking that can be left to another day.)
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 915b8e7787e..40bb2faa362 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -867,7 +867,7 @@ impl<T: ?Sized> Clone for Rc<T> { /// /// let five = Rc::new(5); /// - /// Rc::clone(&five); + /// let _ = Rc::clone(&five); /// ``` #[inline] fn clone(&self) -> Rc<T> { @@ -1304,7 +1304,7 @@ impl<T: ?Sized> Clone for Weak<T> { /// /// let weak_five = Rc::downgrade(&Rc::new(5)); /// - /// Weak::clone(&weak_five); + /// let _ = Weak::clone(&weak_five); /// ``` #[inline] fn clone(&self) -> Weak<T> { diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 9e245fbd7bb..35935861fb1 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -713,7 +713,7 @@ impl<T: ?Sized> Clone for Arc<T> { /// /// let five = Arc::new(5); /// - /// Arc::clone(&five); + /// let _ = Arc::clone(&five); /// ``` #[inline] fn clone(&self) -> Arc<T> { @@ -1135,7 +1135,7 @@ impl<T: ?Sized> Clone for Weak<T> { /// /// let weak_five = Arc::downgrade(&Arc::new(5)); /// - /// Weak::clone(&weak_five); + /// let _ = Weak::clone(&weak_five); /// ``` #[inline] fn clone(&self) -> Weak<T> { |
