rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Fix if_let_mutex not checking Mutexes behind refs

Open lukaslueg opened this issue 3 years ago • 2 comments

Fixes #9193

We can always peel references because we are looking for a method-call, for which autoderef applies.

changelog: [`if_let_mutex`]: detect calls to `Mutex::lock()` if mutex is behind a ref

lukaslueg avatar Aug 10 '22 17:08 lukaslueg

r? @xFrednet

(rust-highfive has picked a reviewer for you, use r? to override)

rust-highfive avatar Aug 10 '22 17:08 rust-highfive

While I was at it, I added some labels which point to the offending usages of the same lock, which I think greatly improves the lint-message

lukaslueg avatar Aug 10 '22 18:08 lukaslueg

changelog: [`if_let_mutex`]: Add labels to the two instances of the same Mutex that will deadlock

lukaslueg avatar Aug 15 '22 18:08 lukaslueg

@xFrednet LGTM

lukaslueg avatar Aug 15 '22 18:08 lukaslueg

LGTM to me as well. Thank you for the work and swift responses!

@bors r+

xFrednet avatar Aug 15 '22 21:08 xFrednet

:pushpin: Commit 6de4bdfa8e36bcf5c814b0d43afc1cefb0630533 has been approved by xFrednet

It is now in the queue for this repository.

bors avatar Aug 15 '22 21:08 bors

:hourglass: Testing commit 6de4bdfa8e36bcf5c814b0d43afc1cefb0630533 with merge 0fc95e88f556d3fb95dd92f19a183a30bb5c9688...

bors avatar Aug 15 '22 21:08 bors

:sunny: Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test Approved by: xFrednet Pushing 0fc95e88f556d3fb95dd92f19a183a30bb5c9688 to master...

bors avatar Aug 15 '22 21:08 bors