From f6b031eb1feed7adeadc39568fe3dbc99e191cdb Mon Sep 17 00:00:00 2001 From: pep Date: Wed, 4 Sep 2024 20:33:16 +0200 Subject: [PATCH] Remove unused Arc/Mutex Signed-off-by: pep --- src/hooks/forgejo.rs | 2 +- src/main.rs | 3 --- src/web.rs | 5 ++--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/hooks/forgejo.rs b/src/hooks/forgejo.rs index fcfe428..c31d719 100644 --- a/src/hooks/forgejo.rs +++ b/src/hooks/forgejo.rs @@ -39,7 +39,7 @@ impl TryFrom for Hook { name: push.repository.name, }, pusher: User { - name: push.pusher.login, + name: push.pusher.username, }, }), _ => return Err(Error::UnsupportedHookConversion), diff --git a/src/main.rs b/src/main.rs index f05360f..bd5a4e3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,8 +28,6 @@ use crate::error::Error; use crate::hooks::Hook; use crate::web::hooks; -use std::sync::{Arc, Mutex}; - use camino::Utf8PathBuf; use clap::{command, value_parser, Arg}; use hyper::{server::conn::http1, service::service_fn}; @@ -62,7 +60,6 @@ async fn main() -> Result { ); let tcp_bind = TcpListener::bind(config.addr).await?; - let value_tx = Arc::new(Mutex::new(value_tx)); loop { let value_tx = value_tx.clone(); diff --git a/src/web.rs b/src/web.rs index 23423ae..db7eb45 100644 --- a/src/web.rs +++ b/src/web.rs @@ -18,7 +18,6 @@ use crate::hooks::{ForgejoHook, GitlabHook, Hook}; use std::convert::Infallible; use std::io::Read; -use std::sync::{Arc, Mutex}; use bytes::{Buf, Bytes}; use hmac::{Hmac, Mac}; @@ -98,12 +97,12 @@ async fn hooks_inner(req: Request, secret: &str) -> Result, secret: &str, - value_tx: Arc>>, + value_tx: UnboundedSender, ) -> Result>, Infallible> { match hooks_inner(req, secret).await { Ok(wh) => { debug!("Passed: {:?}", wh); - value_tx.lock().unwrap().send(wh).unwrap(); + value_tx.send(wh).unwrap(); Ok(Response::new(Full::new(Bytes::from("Hello, World!")))) } Err(err) => error_res(err),