Skip to content

Commit 758b11a

Browse files
committed
Remove the unsafe and mut from the atomic TEST_PORT
1 parent 08110de commit 758b11a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tests/integration.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,15 @@ struct TestConnection {
2121
connection: Connection,
2222
}
2323

24-
static mut TEST_PORT: AtomicU16 = AtomicU16::new(6479);
24+
static TEST_PORT: AtomicU16 = AtomicU16::new(6479);
2525

2626
impl TestConnection {
2727
fn new(module_name: &str) -> Self {
28-
unsafe {
29-
let port = TEST_PORT.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
28+
let port = TEST_PORT.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
3029

31-
Self {
32-
_guards: start_redis(module_name, port).expect("Redis instance started."),
33-
connection: get_redis_connection(port).expect("Established connection to server."),
34-
}
30+
Self {
31+
_guards: start_redis(module_name, port).expect("Redis instance started."),
32+
connection: get_redis_connection(port).expect("Established connection to server."),
3533
}
3634
}
3735
}

0 commit comments

Comments
 (0)