Skip to content

Commit ef454f3

Browse files
authored
Remove unnecessary mut on R_TEST_LOCK (#675)
1 parent 8a957a4 commit ef454f3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/ark/src/r_task.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ where
147147
{
148148
// Escape hatch for unit tests
149149
if stdext::IS_TESTING {
150-
let _lock = unsafe { harp::fixtures::R_TEST_LOCK.lock() };
150+
let _lock = harp::fixtures::R_TEST_LOCK.lock();
151151
r_test_init();
152152
return f();
153153
}
@@ -255,7 +255,7 @@ where
255255
{
256256
// Escape hatch for unit tests
257257
if stdext::IS_TESTING {
258-
let _lock = unsafe { harp::fixtures::R_TEST_LOCK.lock() };
258+
let _lock = harp::fixtures::R_TEST_LOCK.lock();
259259
futures::executor::block_on(fun());
260260
return;
261261
}

crates/harp/src/fixtures/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::R_MAIN_THREAD_ID;
2323

2424
// FIXME: Needs to be a reentrant lock for idle tasks. We can probably do better
2525
// though.
26-
pub static mut R_TEST_LOCK: parking_lot::ReentrantMutex<()> = parking_lot::ReentrantMutex::new(());
26+
pub static R_TEST_LOCK: parking_lot::ReentrantMutex<()> = parking_lot::ReentrantMutex::new(());
2727

2828
static INIT: Once = Once::new();
2929

@@ -35,7 +35,7 @@ static INIT: Once = Once::new();
3535
/// `ark::r_task()` in Ark tests so that Ark initialisation also takes place.
3636
#[cfg(test)]
3737
pub(crate) fn r_task<F: FnOnce()>(f: F) {
38-
let guard = unsafe { R_TEST_LOCK.lock() };
38+
let guard = R_TEST_LOCK.lock();
3939

4040
r_test_init();
4141
f();

0 commit comments

Comments
 (0)