We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This can cause deadlocks. Similar to #5219 but with locks inside the if clause outside of the else clause.
if
else
No response
if let Some(value) = mutex.lock().unwrap().do_something() { *mutex.lock().unwrap() = new_value(); }
Could be written as:
let value = mutex.lock().unwrap().do_something(); if let Some(value) = value { *mutex.lock().unwrap() = new_value(); }
or
let guard = mutex.lock().unwrap(); if let Some(value) = guard.do_something() { *guard = new_value(); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What it does
This can cause deadlocks. Similar to #5219 but with locks inside the
if
clause outside of theelse
clause.Advantage
No response
Drawbacks
No response
Example
Could be written as:
or
The text was updated successfully, but these errors were encountered: