1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-11-09 06:21:06 +01:00

Run cargo fmt using nightly

This commit is contained in:
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, error::ErrorKind,
r0::push::{ r0::push::{
delete_pushrule, get_pushers, get_pushrule, get_pushrule_actions, get_pushrule_enabled, 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::{ push::{
ConditionalPushRuleInit, ContentPushRule, OverridePushRule, PatternedPushRuleInit, ConditionalPushRuleInit, ContentPushRule, OverridePushRule, PatternedPushRuleInit,
RoomPushRule, SenderPushRule, SimplePushRuleInit, UnderridePushRule, RoomPushRule, SenderPushRule, SimplePushRuleInit, UnderridePushRule,
@ -30,7 +31,7 @@ pub async fn get_pushrules_all_route(
let event = db let event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -54,7 +55,7 @@ pub async fn get_pushrule_route(
let event = db let event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -116,7 +117,7 @@ pub async fn set_pushrule_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -262,7 +263,7 @@ pub async fn get_pushrule_actions_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -325,7 +326,7 @@ pub async fn set_pushrule_actions_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -428,7 +429,7 @@ pub async fn get_pushrule_enabled_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -488,7 +489,7 @@ pub async fn set_pushrule_enabled_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",
@ -591,7 +592,7 @@ pub async fn delete_pushrule_route(
let mut event = db let mut event = db
.account_data .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( .ok_or(Error::BadRequest(
ErrorKind::NotFound, ErrorKind::NotFound,
"PushRules event not found.", "PushRules event not found.",

View file

@ -2,7 +2,8 @@ use super::State;
use crate::{ConduitResult, Database, Error, Ruma}; use crate::{ConduitResult, Database, Error, Ruma};
use ruma::{ use ruma::{
api::client::{ 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}, events::{AnyEphemeralRoomEvent, AnyEvent, EventType},
}; };

View file

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

View file

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

View file

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