Use pattern matching better

This commit is contained in:
Tim Kuehn
2016-01-17 22:07:49 -08:00
parent 4a35a86cbc
commit 541dd8f9e6

View File

@@ -562,12 +562,8 @@ mod test {
let client: Arc<Client<Request, Reply>> = 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
}