Skip to content

Commit

Permalink
Make if_let_mutex test pass on both 2021 and 2024 editions
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 15, 2025
1 parent d5ebe50 commit 8a2dae6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/ui/if_let_mutex.edition2021.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
--> tests/ui/if_let_mutex.rs:16:5
--> tests/ui/if_let_mutex.rs:17:5
|
LL | if let Err(locked) = m.lock() {
| ^ - this Mutex will remain locked for the entire `if let`-block...
Expand All @@ -19,7 +19,7 @@ LL | | };
= help: to override `-D warnings` add `#[allow(clippy::if_let_mutex)]`

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

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

error: calling `Mutex::lock` inside the scope of another `Mutex::lock` causes a deadlock
--> tests/ui/if_let_mutex.rs:60:5
--> tests/ui/if_let_mutex.rs:61:5
|
LL | if let Ok(_) = m1.lock() {
| ^ -- this Mutex will remain locked for the entire `if let`-block...
Expand Down
6 changes: 2 additions & 4 deletions tests/ui/if_let_mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//@revisions: edition2021 edition2024
//@[edition2021] edition:2021
//@[edition2024] edition:2024
//@[edition2024] check-pass
#![warn(clippy::if_let_mutex)]
#![allow(clippy::redundant_pattern_matching)]

Expand Down Expand Up @@ -62,10 +63,7 @@ fn multiple_mutexes(m1: &Mutex<()>, m2: &Mutex<()>) {
} else {
m1.lock();
}
//~^ if_let_mutex
//~^ if_let_mutex
//~^ if_let_mutex
//~^ if_let_mutex
//~[edition2021]^^^^^ if_let_mutex
}

fn main() {}

0 comments on commit 8a2dae6

Please sign in to comment.