-
Notifications
You must be signed in to change notification settings - Fork 1.6k
False positive for boxed_local
with trait default methods
#3739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
Not for this particular case. The method spawns a thread which takes ownership of |
The lint is supposed to check if the box is moved inside the body and not warn in that case. In the example below
Can you post more of your code? |
It seems to not detect the value being moved when it's implicitly moved into a closure (e.g. to spawn a thread) |
Fix `boxed_local` suggestion Don't warn about an argument that is moved into a closure. ExprUseVisitor doesn't walk into nested bodies so use a new visitor that collects the variables that are moved into closures. Fixes #3739
Thank you! |
When defining a trait that has a method accepting a
self: Box<Self>
which has a default implementation on the trait itself, theboxed_local
lint is triggered. This was fixed for impls in #3321, but still triggers for traits.Clippy version:
clippy 0.0.212 (b2601be 2018-11-27)
Example Code
clippy output
The text was updated successfully, but these errors were encountered: