diff --git a/src/client_server/backup.rs b/src/client_server/backup.rs
index f33d0de..12f3bfd 100644
--- a/src/client_server/backup.rs
+++ b/src/client_server/backup.rs
@@ -267,12 +267,10 @@ pub async fn get_backup_key_session_route(
let key_data = db
.key_backups
.get_session(&sender_user, &body.version, &body.room_id, &body.session_id)?
- .ok_or_else(|| {
- Error::BadRequest(
- ErrorKind::NotFound,
- "Backup key not found for this user's session.",
- )
- })?;
+ .ok_or(Error::BadRequest(
+ ErrorKind::NotFound,
+ "Backup key not found for this user's session.",
+ ))?;
Ok(get_backup_key_session::Response { key_data }.into())
}
diff --git a/src/client_server/config.rs b/src/client_server/config.rs
index 6abcba2..68cd2e0 100644
--- a/src/client_server/config.rs
+++ b/src/client_server/config.rs
@@ -3,7 +3,10 @@ use crate::{ConduitResult, Database, Error, Ruma};
use ruma::{
api::client::{
error::ErrorKind,
- r0::config::{get_room_account_data, get_global_account_data, set_room_account_data, set_global_account_data},
+ r0::config::{
+ get_global_account_data, get_room_account_data, set_global_account_data,
+ set_room_account_data,
+ },
},
events::{custom::CustomEventContent, BasicEvent},
serde::Raw,
@@ -45,7 +48,10 @@ pub async fn set_global_account_data_route(
#[cfg_attr(
feature = "conduit_bin",
- put("/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>", data = "
")
+ put(
+ "/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>",
+ data = ""
+ )
)]
#[tracing::instrument(skip(db, body))]
pub async fn set_room_account_data_route(
@@ -97,7 +103,10 @@ pub async fn get_global_account_data_route(
#[cfg_attr(
feature = "conduit_bin",
- get("/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>", data = "")
+ get(
+ "/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>",
+ data = ""
+ )
)]
#[tracing::instrument(skip(db, body))]
pub async fn get_room_account_data_route(
@@ -108,7 +117,11 @@ pub async fn get_room_account_data_route(
let data = db
.account_data
- .get::>(Some(&body.room_id), sender_user, body.event_type.clone().into())?
+ .get::>(
+ Some(&body.room_id),
+ sender_user,
+ body.event_type.clone().into(),
+ )?
.ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?;
db.flush().await?;
diff --git a/src/client_server/sync.rs b/src/client_server/sync.rs
index da2ddf4..d38699c 100644
--- a/src/client_server/sync.rs
+++ b/src/client_server/sync.rs
@@ -136,9 +136,7 @@ pub async fn sync_events_route(
.map(|since_shortstatehash| {
Ok::<_, Error>(
since_shortstatehash
- .map(|since_shortstatehash| {
- db.rooms.state_full(&room_id, since_shortstatehash)
- })
+ .map(|since_shortstatehash| db.rooms.state_full(since_shortstatehash))
.transpose()?,
)
})
@@ -512,12 +510,7 @@ pub async fn sync_events_route(
})
.and_then(|shortstatehash| {
db.rooms
- .state_get(
- &room_id,
- shortstatehash,
- &EventType::RoomMember,
- sender_user.as_str(),
- )
+ .state_get(shortstatehash, &EventType::RoomMember, sender_user.as_str())
.ok()?
.ok_or_else(|| Error::bad_database("State hash in db doesn't have a state."))
.ok()
diff --git a/src/client_server/thirdparty.rs b/src/client_server/thirdparty.rs
index fe5b784..5d3c540 100644
--- a/src/client_server/thirdparty.rs
+++ b/src/client_server/thirdparty.rs
@@ -1,7 +1,6 @@
use crate::ConduitResult;
use ruma::api::client::r0::thirdparty::get_protocols;
-use log::warn;
#[cfg(feature = "conduit_bin")]
use rocket::get;
use std::collections::BTreeMap;
diff --git a/src/database/appservice.rs b/src/database/appservice.rs
index 764291d..222eb18 100644
--- a/src/database/appservice.rs
+++ b/src/database/appservice.rs
@@ -55,9 +55,7 @@ impl Appservice {
})
}
- pub fn iter_all<'a>(
- &'a self,
- ) -> impl Iterator- > + 'a {
+ pub fn iter_all(&self) -> impl Iterator
- > + '_ {
self.iter_ids().filter_map(|id| id.ok()).map(move |id| {
Ok((
id.clone(),
diff --git a/src/database/media.rs b/src/database/media.rs
index f958dc8..37fcb74 100644
--- a/src/database/media.rs
+++ b/src/database/media.rs
@@ -262,7 +262,7 @@ impl Media {
}
};
- image.thumbnail_exact(dbg!(exact_width), dbg!(exact_height))
+ image.thumbnail_exact(exact_width, exact_height)
};
let mut thumbnail_bytes = Vec::new();
diff --git a/src/database/rooms.rs b/src/database/rooms.rs
index 91f468f..175d4ac 100644
--- a/src/database/rooms.rs
+++ b/src/database/rooms.rs
@@ -108,7 +108,6 @@ impl Rooms {
pub fn state_full(
&self,
- room_id: &RoomId,
shortstatehash: u64,
) -> Result> {
Ok(self
@@ -151,7 +150,6 @@ impl Rooms {
#[tracing::instrument(skip(self))]
pub fn state_get(
&self,
- room_id: &RoomId,
shortstatehash: u64,
event_type: &EventType,
state_key: &str,
@@ -257,11 +255,11 @@ impl Rooms {
/// Generate a new StateHash.
///
/// A unique hash made from hashing all PDU ids of the state joined with 0xff.
- fn calculate_hash(&self, bytes_list: &[&[u8]]) -> Result {
+ fn calculate_hash(&self, bytes_list: &[&[u8]]) -> StateHashId {
// We only hash the pdu's event ids, not the whole pdu
let bytes = bytes_list.join(&0xff);
let hash = digest::digest(&digest::SHA256, &bytes);
- Ok(hash.as_ref().into())
+ hash.as_ref().into()
}
/// Checks if a room exists.
@@ -291,7 +289,7 @@ impl Rooms {
.values()
.map(|event_id| event_id.as_bytes())
.collect::>(),
- )?;
+ );
let shortstatehash = match self.statehash_shortstatehash.get(&state_hash)? {
Some(shortstatehash) => {
@@ -353,7 +351,7 @@ impl Rooms {
room_id: &RoomId,
) -> Result> {
if let Some(current_shortstatehash) = self.current_shortstatehash(room_id)? {
- self.state_full(&room_id, current_shortstatehash)
+ self.state_full(current_shortstatehash)
} else {
Ok(BTreeMap::new())
}
@@ -368,7 +366,7 @@ impl Rooms {
state_key: &str,
) -> Result