You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Consumes and leaks the Box, returning a mutable reference, &'a mut T./// Note that the type T must outlive the chosen lifetime 'a. If the type/// has only static references, or none at all, then this may be chosen to be 'static.pubfnleak<'a>(b:Box<T,A>) -> &'a mutTwhereA:'a
That is, in the face of generics, 'a is not necessarily 'static.
What it does
Given a function that returns a borrow to a lifetime that isn't used in any parameter, give and explanation and suggest removing the named lifetime and making it
'static
, as it is the only effective lifetime that will work:Lint Name
hidden_static_lifetime
Category
suspicious, style, pedantic
Advantage
It makes the code easier to follow and is a good thing to teach users about.
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: