mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-16 20:49:05 -04:00
room(style): remove one level of indent with an early let/else statement
Classic Benji.
This commit is contained in:
@@ -1103,29 +1103,27 @@ impl Room {
|
||||
use ruma::events::room::encrypted::EncryptedEventScheme;
|
||||
|
||||
let machine = self.client.olm_machine().await;
|
||||
if let Some(machine) = machine.as_ref() {
|
||||
let mut event =
|
||||
match machine.decrypt_room_event(event.cast_ref(), self.inner.room_id()).await {
|
||||
Ok(event) => event,
|
||||
Err(e) => {
|
||||
let event = event.deserialize()?;
|
||||
if let EncryptedEventScheme::MegolmV1AesSha2(c) = event.content.scheme {
|
||||
self.client
|
||||
.encryption()
|
||||
.backups()
|
||||
.maybe_download_room_key(self.room_id().to_owned(), c.session_id);
|
||||
}
|
||||
let machine = machine.as_ref().ok_or(Error::NoOlmMachine)?;
|
||||
|
||||
return Err(e.into());
|
||||
let mut event =
|
||||
match machine.decrypt_room_event(event.cast_ref(), self.inner.room_id()).await {
|
||||
Ok(event) => event,
|
||||
Err(e) => {
|
||||
let event = event.deserialize()?;
|
||||
if let EncryptedEventScheme::MegolmV1AesSha2(c) = event.content.scheme {
|
||||
self.client
|
||||
.encryption()
|
||||
.backups()
|
||||
.maybe_download_room_key(self.room_id().to_owned(), c.session_id);
|
||||
}
|
||||
};
|
||||
|
||||
event.push_actions = self.event_push_actions(&event.event).await?;
|
||||
return Err(e.into());
|
||||
}
|
||||
};
|
||||
|
||||
Ok(event)
|
||||
} else {
|
||||
Err(Error::NoOlmMachine)
|
||||
}
|
||||
event.push_actions = self.event_push_actions(&event.event).await?;
|
||||
|
||||
Ok(event)
|
||||
}
|
||||
|
||||
/// Forces the currently active room key, which is used to encrypt messages,
|
||||
|
||||
Reference in New Issue
Block a user