-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add a lint for unbound mutex guards #13869
Comments
This lint exists and emits errors on the reproducer you shared:
|
Ah, sorry; that error snippet from me is even a builtin compiler lint. The clippy lint is for external mutexes like the one in |
Oh, you are right that the one with |
Ah, I'd overlooked that your reproducer also tested it for |
Thank you. I just want to emphasize that it is not only |
What it does
When working with various synchronization primitives, such as
Mutex
andRwLock
, it is easy to make the mistake of not binding the corresponding guard to the current scope. It would be helpful to assist.Advantage
No response
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: