From 30701cc6fbfea03f7ac0e4b7f5af883592791abf Mon Sep 17 00:00:00 2001 From: Lorenz Leutgeb Date: Tue, 17 Feb 2026 19:35:17 +0100 Subject: [PATCH] node/runtime: Make `Runtime::run` more readable A small refactoring that reorders arms of a match and makes them shorter by precise imports. --- crates/radicle-node/src/reactor.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/radicle-node/src/reactor.rs b/crates/radicle-node/src/reactor.rs index 3caed93f..df337929 100644 --- a/crates/radicle-node/src/reactor.rs +++ b/crates/radicle-node/src/reactor.rs @@ -418,13 +418,14 @@ impl Runtime { if self.handle_events(tick, events) { // If a wake event was emitted, eagerly consume all control messages. loop { + use ControlMessage::*; + use TryRecvError::*; + match self.receiver.try_recv() { - Err(TryRecvError::Empty) => break, - Err(TryRecvError::Disconnected) => { - panic!("control channel disconnected unexpectedly") - } - Ok(ControlMessage::Shutdown) => return self.handle_shutdown(), - Ok(ControlMessage::Command(cmd)) => self.service.handle_command(*cmd), + Ok(Command(cmd)) => self.service.handle_command(*cmd), + Ok(Shutdown) => return self.handle_shutdown(), + Err(Empty) => break, + Err(Disconnected) => panic!("control channel disconnected unexpectedly"), } } }