Skip to content

Commit

Permalink
Remove the unsafe and mut from the atomic TEST_PORT
Browse files Browse the repository at this point in the history
  • Loading branch information
iddm committed May 27, 2024
1 parent 08110de commit 758b11a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ struct TestConnection {
connection: Connection,
}

static mut TEST_PORT: AtomicU16 = AtomicU16::new(6479);
static TEST_PORT: AtomicU16 = AtomicU16::new(6479);

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

Self {
_guards: start_redis(module_name, port).expect("Redis instance started."),
connection: get_redis_connection(port).expect("Established connection to server."),
}
Self {
_guards: start_redis(module_name, port).expect("Redis instance started."),
connection: get_redis_connection(port).expect("Established connection to server."),
}
}
}
Expand Down

0 comments on commit 758b11a

Please sign in to comment.