Skip to content

Commit 8a2dae6

Browse files
Make if_let_mutex test pass on both 2021 and 2024 editions
1 parent d5ebe50 commit 8a2dae6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

tests/ui/if_let_mutex.edition2021.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
2-
--> tests/ui/if_let_mutex.rs:16:5
2+
--> tests/ui/if_let_mutex.rs:17:5
33
|
44
LL | if let Err(locked) = m.lock() {
55
| ^ - this Mutex will remain locked for the entire `if let`-block...
@@ -19,7 +19,7 @@ LL | | };
1919
= help: to override `-D warnings` add `#[allow(clippy::if_let_mutex)]`
2020

2121
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
22-
--> tests/ui/if_let_mutex.rs:29:5
22+
--> tests/ui/if_let_mutex.rs:30:5
2323
|
2424
LL | if let Some(locked) = m.lock().unwrap().deref() {
2525
| ^ - this Mutex will remain locked for the entire `if let`-block...
@@ -37,7 +37,7 @@ LL | | };
3737
= help: move the lock call outside of the `if let ...` expression
3838

3939
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
40-
--> tests/ui/if_let_mutex.rs:51:5
40+
--> tests/ui/if_let_mutex.rs:52:5
4141
|
4242
LL | if let Ok(i) = mutex.lock() {
4343
| ^ ----- this Mutex will remain locked for the entire `if let`-block...
@@ -54,7 +54,7 @@ LL | | };
5454
= help: move the lock call outside of the `if let ...` expression
5555

5656
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
57-
--> tests/ui/if_let_mutex.rs:60:5
57+
--> tests/ui/if_let_mutex.rs:61:5
5858
|
5959
LL | if let Ok(_) = m1.lock() {
6060
| ^ -- this Mutex will remain locked for the entire `if let`-block...

tests/ui/if_let_mutex.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//@revisions: edition2021 edition2024
44
//@[edition2021] edition:2021
55
//@[edition2024] edition:2024
6+
//@[edition2024] check-pass
67
#![warn(clippy::if_let_mutex)]
78
#![allow(clippy::redundant_pattern_matching)]
89

@@ -62,10 +63,7 @@ fn multiple_mutexes(m1: &Mutex<()>, m2: &Mutex<()>) {
6263
} else {
6364
m1.lock();
6465
}
65-
//~^ if_let_mutex
66-
//~^ if_let_mutex
67-
//~^ if_let_mutex
68-
//~^ if_let_mutex
66+
//~[edition2021]^^^^^ if_let_mutex
6967
}
7068

7169
fn main() {}

0 commit comments

Comments
 (0)