Remove unsafe

This commit is contained in:
xmppftw 2024-08-07 11:53:54 +02:00 committed by Maxime “pep” Buquet
parent 94ac2d8818
commit ac67c52bee

View file

@ -62,12 +62,11 @@ async fn main() -> Result<!, Error> {
);
let tcp_bind = TcpListener::bind(config.addr).await?;
let secret: &'static String =
unsafe { core::mem::transmute::<&String, &'static String>(&config.secret) };
let value_tx = Arc::new(Mutex::new(value_tx));
loop {
let value_tx = value_tx.clone();
let secret = config.secret.clone();
tokio::select! {
_ = client.next() => (),
@ -79,8 +78,9 @@ async fn main() -> Result<!, Error> {
.timer(TokioTimer::new())
.serve_connection(io, service_fn(|request| {
let value_tx = value_tx.clone();
let secret = secret.clone();
async move {
hooks(request, secret, value_tx).await
hooks(request, &secret, value_tx).await
}
}))
.await