From f44cce25abc884e6ec14e8fb8608a4245e6bb9e0 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 4 Jul 2025 13:00:46 +0200 Subject: Clippy lint fixes --- src/main.rs | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/main.rs b/src/main.rs index edbfa1d..cf0dbb7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,29 +80,26 @@ async fn main() -> anyhow::Result<()> { } loop { let notification = event_loop.poll().await; - match notification? { - Incoming(Packet::Publish(p)) => { - for (topic, route) in conf.routes.iter() { - if !topic_match(&topic, &p.topic) { - continue; - } - for program in &route.programs { - // TODO: Switch to moro_local to avoid this ewwyness - let program = program.clone(); - let p = p.clone(); - tokio::spawn(async move { - match timeout(Duration::from_secs(60), run(&program, &p)).await { - Err(_) => eprintln!( - "error: Execution of {program:?} for message {p:?} timed out" - ), - Ok(Err(e)) => eprintln!("error: Failed to run {program:?}: {e:?}"), - _ => (), - } - }); - } + if let Incoming(Packet::Publish(p)) = notification? { + for (topic, route) in conf.routes.iter() { + if !topic_match(topic, &p.topic) { + continue; + } + for program in &route.programs { + // TODO: Switch to moro_local to avoid this ewwyness + let program = program.clone(); + let p = p.clone(); + tokio::spawn(async move { + match timeout(Duration::from_secs(60), run(&program, &p)).await { + Err(_) => eprintln!( + "error: Execution of {program:?} for message {p:?} timed out" + ), + Ok(Err(e)) => eprintln!("error: Failed to run {program:?}: {e:?}"), + _ => (), + } + }); } } - _ => (), } } } -- cgit v1.2.3-70-g09d2