From a45bbec25952a15cacb105b536432d6fbe3fb7b1 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sun, 30 Jun 2024 04:42:07 +0200 Subject: jsonrpc: remove unwrap() and use expect() for examples, docs, and tests --- jsonrpc/tests/impl_rpc_service.rs | 7 +++++-- jsonrpc/tests/rpc_impl.rs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'jsonrpc/tests') diff --git a/jsonrpc/tests/impl_rpc_service.rs b/jsonrpc/tests/impl_rpc_service.rs index bb42679..52c5c31 100644 --- a/jsonrpc/tests/impl_rpc_service.rs +++ b/jsonrpc/tests/impl_rpc_service.rs @@ -21,7 +21,10 @@ fn service() { let params = serde_json::json!("params"); smol::block_on(async { - let foo_method = f.get_method("foo").unwrap(); - assert_eq!(foo_method(params.clone()).await.unwrap(), params); + let foo_method = f.get_method("foo").expect("Get method foo"); + assert_eq!( + foo_method(params.clone()).await.expect("Call foo method"), + params + ); }); } diff --git a/jsonrpc/tests/rpc_impl.rs b/jsonrpc/tests/rpc_impl.rs index 64e3bb1..2a24bbf 100644 --- a/jsonrpc/tests/rpc_impl.rs +++ b/jsonrpc/tests/rpc_impl.rs @@ -20,7 +20,10 @@ fn rpc_impl_service() { let params = serde_json::json!("params"); smol::block_on(async { - let foo_method = f.get_method("foo").unwrap(); - assert_eq!(foo_method(params.clone()).await.unwrap(), params); + let foo_method = f.get_method("foo").expect("Get method foo"); + assert_eq!( + foo_method(params.clone()).await.expect("Call foo method"), + params + ); }); } -- cgit v1.2.3