Skip to content

Commit 30701cc

Browse files
lorenzleutgebFintanH
authored andcommitted
node/runtime: Make Runtime::run more readable
A small refactoring that reorders arms of a match and makes them shorter by precise imports.
1 parent 057edf5 commit 30701cc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

crates/radicle-node/src/reactor.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,14 @@ impl<H: ReactionHandler> Runtime<H> {
418418
if self.handle_events(tick, events) {
419419
// If a wake event was emitted, eagerly consume all control messages.
420420
loop {
421+
use ControlMessage::*;
422+
use TryRecvError::*;
423+
421424
match self.receiver.try_recv() {
422-
Err(TryRecvError::Empty) => break,
423-
Err(TryRecvError::Disconnected) => {
424-
panic!("control channel disconnected unexpectedly")
425-
}
426-
Ok(ControlMessage::Shutdown) => return self.handle_shutdown(),
427-
Ok(ControlMessage::Command(cmd)) => self.service.handle_command(*cmd),
425+
Ok(Command(cmd)) => self.service.handle_command(*cmd),
426+
Ok(Shutdown) => return self.handle_shutdown(),
427+
Err(Empty) => break,
428+
Err(Disconnected) => panic!("control channel disconnected unexpectedly"),
428429
}
429430
}
430431
}

0 commit comments

Comments
 (0)