diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-07-04 13:00:46 +0200 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2025-07-04 13:00:46 +0200 |
commit | f44cce25abc884e6ec14e8fb8608a4245e6bb9e0 (patch) | |
tree | e629d71130a23523117dc7c387e35c580671a7c8 /src/main.rs | |
parent | d016176a3c5bd80f28315032e1176ab91e4fae85 (diff) | |
download | mqttr-f44cce25abc884e6ec14e8fb8608a4245e6bb9e0.tar.gz mqttr-f44cce25abc884e6ec14e8fb8608a4245e6bb9e0.tar.xz mqttr-f44cce25abc884e6ec14e8fb8608a4245e6bb9e0.zip |
Clippy lint fixes
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 39 |
1 files 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:?}"), + _ => (), + } + }); } } - _ => (), } } } |