mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
17 lines
280 B
Rust
17 lines
280 B
Rust
#![warn(clippy::if_let_mutex)]
|
|
|
|
use std::sync::Mutex;
|
|
|
|
fn do_stuff<T>(_: T) {}
|
|
fn foo() {
|
|
let m = Mutex::new(1u8);
|
|
|
|
if let Err(locked) = m.lock() {
|
|
do_stuff(locked);
|
|
} else {
|
|
let lock = m.lock().unwrap();
|
|
do_stuff(lock);
|
|
};
|
|
}
|
|
|
|
fn main() {}
|