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