Run cargo fmt using nightly

next
Devin Ragotzy 2021-01-26 21:53:03 -05:00
parent 56b816a2be
commit a0ecd76e21
6 changed files with 37 additions and 24 deletions

View File

@ -5,10 +5,11 @@ use ruma::{
error::ErrorKind,
r0::push::{
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions, get_pushrule_enabled,
get_pushrules_all, set_pushrule, set_pushrule_actions, set_pushrule_enabled, RuleKind,
get_pushrules_all, set_pusher, set_pushrule, set_pushrule_actions,
set_pushrule_enabled, RuleKind,
},
},
events::EventType,
events::{push_rules, EventType},
push::{
ConditionalPushRuleInit, ContentPushRule, OverridePushRule, PatternedPushRuleInit,
RoomPushRule, SenderPushRule, SimplePushRuleInit, UnderridePushRule,
@ -30,7 +31,7 @@ pub async fn get_pushrules_all_route(
let event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -54,7 +55,7 @@ pub async fn get_pushrule_route(
let event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -116,7 +117,7 @@ pub async fn set_pushrule_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -262,7 +263,7 @@ pub async fn get_pushrule_actions_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -325,7 +326,7 @@ pub async fn set_pushrule_actions_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -428,7 +429,7 @@ pub async fn get_pushrule_enabled_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -488,7 +489,7 @@ pub async fn set_pushrule_enabled_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",
@ -591,7 +592,7 @@ pub async fn delete_pushrule_route(
let mut event = db
.account_data
.get::<ruma::events::push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.get::<push_rules::PushRulesEvent>(None, &sender_user, EventType::PushRules)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"PushRules event not found.",

View File

@ -2,7 +2,8 @@ use super::State;
use crate::{ConduitResult, Database, Error, Ruma};
use ruma::{
api::client::{
error::ErrorKind, r0::capabilities::get_capabilities, r0::read_marker::set_read_marker,
error::ErrorKind,
r0::{capabilities::get_capabilities, read_marker::set_read_marker},
},
events::{AnyEphemeralRoomEvent, AnyEvent, EventType},
};

View File

@ -1,6 +1,8 @@
use crate::{utils, Error, Result};
use std::collections::HashMap;
use std::sync::{Arc, RwLock};
use std::{
collections::HashMap,
sync::{Arc, RwLock},
};
#[derive(Clone)]
pub struct Appservice {

View File

@ -4,10 +4,11 @@ use ruma::{
api::federation::discovery::{ServerSigningKeys, VerifyKey},
ServerName, ServerSigningKeyId,
};
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;
use std::sync::RwLock;
use std::time::Duration;
use std::{
collections::{BTreeMap, HashMap},
sync::{Arc, RwLock},
time::Duration,
};
use trust_dns_resolver::TokioAsyncResolver;
pub const COUNTER: &str = "c";

View File

@ -1,4 +1,8 @@
use std::{collections::HashMap, sync::RwLock, time::Duration, time::Instant};
use std::{
collections::HashMap,
sync::RwLock,
time::{Duration, Instant},
};
use log::error;
use ruma::{

View File

@ -18,11 +18,15 @@ pub use rocket::State;
pub use ruma_wrapper::{ConduitResult, Ruma, RumaResponse};
use log::LevelFilter;
use rocket::figment::{
use rocket::{
catch, catchers,
fairing::AdHoc,
figment::{
providers::{Env, Format, Toml},
Figment,
},
routes, Request,
};
use rocket::{catch, catchers, fairing::AdHoc, routes, Request};
fn setup_rocket() -> rocket::Rocket {
// Force log level off, so we can use our own logger
@ -143,6 +147,7 @@ fn setup_rocket() -> rocket::Rocket {
client_server::get_key_changes_route,
client_server::get_pushers_route,
client_server::set_pushers_route,
// client_server::third_party_route,
client_server::upgrade_room_route,
server_server::get_server_version_route,
server_server::get_server_keys_route,
@ -165,8 +170,7 @@ fn setup_rocket() -> rocket::Rocket {
.await
.expect("config is valid");
data.sending
.start_handler(&data.globals, &data.rooms, &data.appservice);
data.sending.start_handler(&data);
log::set_boxed_logger(Box::new(ConduitLogger {
db: data.clone(),
last_logs: Default::default(),