]> git.lizzy.rs Git - rust.git/commit
Add `let_underscore_lock` lint.
authorAaron Kofsky <aaronko@umich.edu>
Tue, 31 May 2022 18:05:04 +0000 (14:05 -0400)
committerAaron Kofsky <aaronko@umich.edu>
Sat, 4 Jun 2022 19:34:02 +0000 (15:34 -0400)
commitad7587fedcf29a6629e0218f0e180ddf8960461d
tree6c84dea72c06215dfa36d5597852d5716461ffaa
parent821b32bd406e9c29b2e9ca2a647d30021cff653d
Add `let_underscore_lock` lint.

Similar to `let_underscore_drop`, this lint checks for statements similar
to `let _ = foo`, where `foo` is a lock guard. These types of let
statements are especially problematic because the lock gets released
immediately, instead of at the end of the scope. This behavior is almost
always the wrong thing.
compiler/rustc_lint/src/let_underscore.rs
compiler/rustc_lint/src/lib.rs
src/test/ui/let_underscore_lock.rs [new file with mode: 0644]
src/test/ui/let_underscore_lock.stderr [new file with mode: 0644]