From ab91a6b4df04a60cf19682b1f016848d3e4784ad Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Thu, 11 Oct 2018 23:10:37 -0700 Subject: `#[must_use]` for associated functions is supposed to actually work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) --- src/liballoc/sync.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/liballoc/sync.rs') 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 Clone for Arc { /// /// let five = Arc::new(5); /// - /// Arc::clone(&five); + /// let _ = Arc::clone(&five); /// ``` #[inline] fn clone(&self) -> Arc { @@ -1135,7 +1135,7 @@ impl Clone for Weak { /// /// let weak_five = Arc::downgrade(&Arc::new(5)); /// - /// Weak::clone(&weak_five); + /// let _ = Weak::clone(&weak_five); /// ``` #[inline] fn clone(&self) -> Weak { -- cgit 1.4.1-3-g733a5