2 #![warn(clippy::await_holding_lock)]
6 async fn bad(x: &Mutex<u32>) -> u32 {
7 let guard = x.lock().unwrap();
11 async fn good(x: &Mutex<u32>) -> u32 {
13 let guard = x.lock().unwrap();
17 let guard = x.lock().unwrap();
21 async fn baz() -> u32 {
25 async fn also_bad(x: &Mutex<u32>) -> u32 {
26 let first = baz().await;
28 let guard = x.lock().unwrap();
30 let second = baz().await;
32 let third = baz().await;
34 first + second + third
38 let m = Mutex::new(100);