From 721c4595777b76cf1bbe6f7ae4723132e024f242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Mon, 28 Sep 2020 15:07:57 +0200 Subject: [PATCH] crypto: Collapse an if tree. --- matrix_sdk_crypto/src/key_request.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/matrix_sdk_crypto/src/key_request.rs b/matrix_sdk_crypto/src/key_request.rs index 69cdb4c2..ea74ef1e 100644 --- a/matrix_sdk_crypto/src/key_request.rs +++ b/matrix_sdk_crypto/src/key_request.rs @@ -360,19 +360,17 @@ impl KeyRequestMachine { } else { Err(KeyshareDecision::UntrustedDevice) } - } else { - if let Some(outbound) = outbound_session { - if outbound - .shared_with() - .contains(&(device.user_id().to_owned(), device.device_id().to_owned())) - { - Ok(()) - } else { - Err(KeyshareDecision::OutboundSessionNotShared) - } + } else if let Some(outbound) = outbound_session { + if outbound + .shared_with() + .contains(&(device.user_id().to_owned(), device.device_id().to_owned())) + { + Ok(()) } else { - Err(KeyshareDecision::MissingOutboundSession) + Err(KeyshareDecision::OutboundSessionNotShared) } + } else { + Err(KeyshareDecision::MissingOutboundSession) } }