]> git.lizzy.rs Git - rust.git/commit
Explain why let-underscoring a lock guard is incorrect.
authorAaron Kofsky <aaronko@umich.edu>
Thu, 4 Aug 2022 21:00:48 +0000 (17:00 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Thu, 4 Aug 2022 21:00:48 +0000 (17:00 -0400)
commita9f1b7bd2a25e34de29eb88f81550690f4fec5dc
tree3a5ac965a3c4c7e45af33eb97b258870b1242b0a
parenta9095ff2139fb305b15006d1f2a1ff16da0b6c29
Explain why let-underscoring a lock guard is incorrect.

Currently, the let_underscore_lock lint simply tells what is wrong, but
not why it is wrong. We fix this by using a `MultiSpan` to explain
specifically that doing `let _ = ` immediately drops the lock guard
because it does not assign the lock guard to a binding.
compiler/rustc_lint/src/let_underscore.rs
src/test/ui/lint/let_underscore/let_underscore_lock.stderr