Browse Source

nit: use `let ... else` syntax

Justin Tracey 1 year ago
parent
commit
1f246c5d0b
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/bin/mgen-peer.rs

+ 1 - 3
src/bin/mgen-peer.rs

@@ -136,9 +136,7 @@ async fn reader(
         // wait for listener or writer thread to give us a stream to read from
         let mut stream = connection_channel.recv().await;
         loop {
-            let msg = if let Ok(msg) = mgen::get_message(&mut stream).await {
-                msg
-            } else {
+            let Ok(msg) = mgen::get_message(&mut stream).await else {
                 // Unlike the client-server case, we can assume that if there
                 // were a message someone was trying to send us, they'd make
                 // sure to re-establish the connection; so when the socket