From 26b30cd030afcaef49945b033c74297fb12a23ea Mon Sep 17 00:00:00 2001 From: videogame hacker Date: Sat, 5 Mar 2022 15:25:54 +0000 Subject: [PATCH] Simplify watch loop --- build_src/main.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/build_src/main.rs b/build_src/main.rs index 8716f44..95ddbd0 100644 --- a/build_src/main.rs +++ b/build_src/main.rs @@ -74,11 +74,8 @@ fn main() { let mut watcher = watcher(tx, Duration::from_millis(100)).unwrap(); watcher.watch("./src", RecursiveMode::Recursive).unwrap(); - loop { - match rx.recv() { - Ok(_) => build(), - Err(_) => break, - } + while rx.recv().is_ok() { + build() } } }