fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock 2 --> $DIR/if_let_mutex.rs:10:5 3 | 4LL | if let Err(locked) = m.lock() { 5 | ^ - this Mutex will remain locked for the entire `if let`-block... 6 | _____| 7 | | 8LL | | 9LL | | do_stuff(locked); 10LL | | } else { 11LL | | let lock = m.lock().unwrap(); 12 | | - ... and is tried to lock again here, which will always deadlock. 13LL | | do_stuff(lock); 14LL | | }; 15 | |_____^ 16 | 17 = help: move the lock call outside of the `if let ...` expression 18 = note: `-D clippy::if-let-mutex` implied by `-D warnings` 19 = help: to override `-D warnings` add `#[allow(clippy::if_let_mutex)]` 20 21error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock 22 --> $DIR/if_let_mutex.rs:23:5 23 | 24LL | if let Some(locked) = m.lock().unwrap().deref() { 25 | ^ - this Mutex will remain locked for the entire `if let`-block... 26 | _____| 27 | | 28LL | | 29LL | | do_stuff(locked); 30LL | | } else { 31LL | | let lock = m.lock().unwrap(); 32 | | - ... and is tried to lock again here, which will always deadlock. 33LL | | do_stuff(lock); 34LL | | }; 35 | |_____^ 36 | 37 = help: move the lock call outside of the `if let ...` expression 38 39error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock 40 --> $DIR/if_let_mutex.rs:45:5 41 | 42LL | if let Ok(i) = mutex.lock() { 43 | ^ ----- this Mutex will remain locked for the entire `if let`-block... 44 | _____| 45 | | 46LL | | 47LL | | do_stuff(i); 48LL | | } else { 49LL | | let _x = mutex.lock(); 50 | | ----- ... and is tried to lock again here, which will always deadlock. 51LL | | }; 52 | |_____^ 53 | 54 = help: move the lock call outside of the `if let ...` expression 55 56error: aborting due to 3 previous errors 57