From ac67c52bee5eb9dbd5849a33fa476a501c5c4bce Mon Sep 17 00:00:00 2001 From: xmppftw Date: Wed, 7 Aug 2024 11:53:54 +0200 Subject: [PATCH] Remove unsafe --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1af34f9..a054f24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,12 +62,11 @@ async fn main() -> Result { ); 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 { .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