[sdk] reduce verifying client handler indentation
@@ -447,9 +447,16 @@ fn verifying_get_account(address: AccountAddress, version: Option<Version>) -> V
address, version, None,
)];
let callback: RequestCallback = |ctxt, subresponses| {
- match subresponses {
- [MethodResponse::GetAccountStateWithProof(ref account)] =>
- {
+ let account = match subresponses {
+ [MethodResponse::GetAccountStateWithProof(ref account)] => account,
+ subresponses => {
+ return Err(Error::rpc_response(format!(
+ "expected [GetEventsWithProofs] subresponses, received: {:?}",
+ subresponses,
+ )))
+ }
+ };
+
let account_state_with_proof =
AccountStateWithProof::try_from(account).map_err(Error::decode)?;
@@ -468,23 +475,13 @@ fn verifying_get_account(address: AccountAddress, version: Option<Version>) -> V
let maybe_account_view = account_state_with_proof
.blob
.map(|blob| {
- let account_state = AccountState::try_from(&blob)
- .map_err(Error::decode)?;
- AccountView::try_from_account_state(
- address,
- account_state,
- version,
- ).map_err(Error::decode)
+ let account_state = AccountState::try_from(&blob).map_err(Error::decode)?;
+ AccountView::try_from_account_state(address, account_state, version)
+ .map_err(Error::decode)
})
.transpose()?;
Ok(MethodResponse::GetAccount(maybe_account_view))
- }
- subresponses => return Err(Error::rpc_response(format!(
- "expected [GetAccountStateWithProof, GetAccountStateWithProof] subresponses, received: {:?}",
- subresponses,
- ))),
- }
};
VerifyingRequest::new(request, subrequests, callback)
}
