chore: get rid of warnings

This commit is contained in:
Timo Kösters 2021-03-24 11:52:10 +01:00
parent e50f2864de
commit 16eed1d8c2
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
9 changed files with 82 additions and 96 deletions

View file

@ -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())
}

View file

@ -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 = "<body>")
put(
"/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>",
data = "<body>"
)
)]
#[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 = "<body>")
get(
"/_matrix/client/r0/user/<_>/rooms/<_>/account_data/<_>",
data = "<body>"
)
)]
#[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::<Raw<ruma::events::AnyBasicEvent>>(Some(&body.room_id), sender_user, body.event_type.clone().into())?
.get::<Raw<ruma::events::AnyBasicEvent>>(
Some(&body.room_id),
sender_user,
body.event_type.clone().into(),
)?
.ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?;
db.flush().await?;

View file

@ -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()

View file

@ -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;