creating suggestion

This commit is contained in:
Devin R 2020-03-05 18:02:22 -05:00
parent 001a42e632
commit 139e2c6227
4 changed files with 9 additions and 1 deletions

View file

@ -30,7 +30,7 @@ declare_clippy_lint! {
/// ```
pub IF_LET_MUTEX,
correctness,
"locking a `Mutex` in an `if let` block can cause deadlock"
"locking a `Mutex` in an `if let` block can cause deadlocks"
}
declare_lint_pass!(IfLetMutex => [IF_LET_MUTEX]);

BIN
if_let_mutex Executable file

Binary file not shown.

BIN
redundant_pattern_matching Executable file

Binary file not shown.

View file

@ -85,6 +85,7 @@ fn main() {
let _ = does_something();
let _ = returns_unit();
let _ = issue_5271();
let opt = Some(false);
let x = if let Some(_) = opt { true } else { false };
@ -112,3 +113,10 @@ fn returns_unit() {
false
};
}
fn issue_5271() {
let hello = Some(String::from("hello"));
let _x = match hello {
s @ _ => drop(s),
};
}