#[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.)
This commit is contained in:
parent
c47785f6be
commit
ab91a6b4df
6 changed files with 31 additions and 16 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue