From cecb29b46fa1dfc7f0f75c7097b007756cc45346 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Sat, 28 Nov 2020 14:09:44 +0700 Subject: [PATCH] Less naked while loop to print error on deser fail Co-Authored-By: twistedddx --- src/bc_protocol/connection.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/bc_protocol/connection.rs b/src/bc_protocol/connection.rs index 94defc2..16683ef 100644 --- a/src/bc_protocol/connection.rs +++ b/src/bc_protocol/connection.rs @@ -55,15 +55,12 @@ impl BcConnection { let rx_thread = std::thread::spawn(move || { let mut context = BcContext::new(); + let mut result; while { - match BcConnection::poll(&mut context, &conn, &mut subs) { - Ok(_) => true, - Err(err) => { - error!("Deserialization error: {:?}", err); - false - } - } + result = BcConnection::poll(&mut context, &conn, &mut subs); + result.is_ok() } {} + error!("Deserialization error: {:?}", result.unwrap_err()); }); Ok(BcConnection {