From 541dd8f9e6f473a9e827aa86d93d047cfc4b53f1 Mon Sep 17 00:00:00 2001 From: Tim Kuehn Date: Sun, 17 Jan 2016 22:07:49 -0800 Subject: [PATCH] Use pattern matching better --- tarpc/src/protocol.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tarpc/src/protocol.rs b/tarpc/src/protocol.rs index 3ba2397..b91b6b0 100644 --- a/tarpc/src/protocol.rs +++ b/tarpc/src/protocol.rs @@ -562,12 +562,8 @@ mod test { let client: Arc> = Arc::new(Client::new(addr, None).unwrap()); serve_handle.shutdown(); match client.rpc(&Request::Increment) { - ok @ Ok(_) => panic!("Expected Err, got {:?}", ok), - Err(e) => if let super::Error::ConnectionBroken = e { - /* success */ - } else { - panic!("Expected Error::ConnectionBroken, got {:?}", e); - }, + Err(super::Error::ConnectionBroken) => {}, // success + otherwise => panic!("Expected Err(ConnectionBroken), got {:?}", otherwise), } let _ = client.rpc(&Request::Increment); // Test whether second failure hangs }