1
Fork 0

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.
This commit is contained in:
Aaron Kofsky 2022-05-31 14:05:04 -04:00
parent 821b32bd40
commit ad7587fedc
4 changed files with 91 additions and 3 deletions

View file

@ -317,7 +317,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
REDUNDANT_SEMICOLONS
);
add_lint_group!("let_underscore", LET_UNDERSCORE_DROP);
add_lint_group!("let_underscore", LET_UNDERSCORE_DROP, LET_UNDERSCORE_LOCK);
add_lint_group!(
"rust_2018_idioms",