1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2024-12-28 05:44:37 +01:00

cargo fix

This commit is contained in:
Timo Kösters 2022-10-05 20:41:05 +02:00 committed by Nyaaori
parent a4637e2ba1
commit f47a5cd5d5
No known key found for this signature in database
GPG key ID: E7819C3ED4D1F82E
21 changed files with 51 additions and 79 deletions

View file

@ -1,4 +1,4 @@
use std::sync::Arc;
use super::{DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
use crate::{api::client_server, services, utils, Error, Result, Ruma};
@ -13,14 +13,13 @@ use ruma::{
},
events::{
room::{
member::{MembershipState, RoomMemberEventContent},
message::RoomMessageEventContent,
},
GlobalAccountDataEventType, RoomEventType,
GlobalAccountDataEventType,
},
push, UserId,
};
use serde_json::value::to_raw_value;
use tracing::{info, warn};
use register::RegistrationKind;

View file

@ -12,26 +12,21 @@ use ruma::{
},
events::{
room::{
create::RoomCreateEventContent,
member::{MembershipState, RoomMemberEventContent},
},
RoomEventType, StateEventType,
},
serde::{to_canonical_value, Base64, CanonicalJsonObject, CanonicalJsonValue},
state_res::{self, RoomVersion},
uint, EventId, RoomId, RoomVersionId, ServerName, UserId,
serde::{to_canonical_value, Base64, CanonicalJsonObject, CanonicalJsonValue}, EventId, RoomId, RoomVersionId, ServerName, UserId,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use std::{
collections::{hash_map::Entry, BTreeMap, HashMap, HashSet},
iter,
sync::{Arc, RwLock},
time::{Duration, Instant},
};
use tracing::{debug, error, warn};
use crate::{
api::{client_server, server_server},
service::pdu::{gen_event_id_canonical_json, PduBuilder},
services, utils, Error, PduEvent, Result, Ruma,
};

View file

@ -62,7 +62,7 @@ pub async fn delete_tag_route(
) -> Result<delete_tag::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let mut event = services().account_data.get(
let event = services().account_data.get(
Some(&body.room_id),
sender_user,
RoomAccountDataEventType::Tag,
@ -103,13 +103,13 @@ pub async fn get_tags_route(
) -> Result<get_tags::v3::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let mut event = services().account_data.get(
let event = services().account_data.get(
Some(&body.room_id),
sender_user,
RoomAccountDataEventType::Tag,
)?;
let mut tags_event = event
let tags_event = event
.map(|e| {
serde_json::from_str(e.get())
.map_err(|_| Error::bad_database("Invalid account data event in db."))

View file

@ -24,7 +24,7 @@ use serde::Deserialize;
use tracing::{debug, error, warn};
use super::{Ruma, RumaResponse};
use crate::{api::server_server, services, Error, Result};
use crate::{services, Error, Result};
#[async_trait]
impl<T, B> FromRequest<B> for Ruma<T>

View file

@ -4,10 +4,10 @@ use crate::{
services, utils, Error, PduEvent, Result, Ruma,
};
use axum::{response::IntoResponse, Json};
use futures_util::{stream::FuturesUnordered, StreamExt};
use futures_util::{StreamExt};
use get_profile_information::v1::ProfileField;
use http::header::{HeaderValue, AUTHORIZATION};
use regex::Regex;
use ruma::{
api::{
client::error::{Error as RumaError, ErrorKind},
@ -16,8 +16,7 @@ use ruma::{
device::get_devices::{self, v1::UserDevice},
directory::{get_public_rooms, get_public_rooms_filtered},
discovery::{
get_remote_server_keys, get_remote_server_keys_batch,
get_remote_server_keys_batch::v2::QueryCriteria, get_server_keys,
get_server_keys,
get_server_version, ServerSigningKeys, VerifyKey,
},
event::{get_event, get_missing_events, get_room_state, get_room_state_ids},
@ -40,36 +39,28 @@ use ruma::{
events::{
receipt::{ReceiptEvent, ReceiptEventContent},
room::{
create::RoomCreateEventContent,
join_rules::{JoinRule, RoomJoinRulesEventContent},
member::{MembershipState, RoomMemberEventContent},
server_acl::RoomServerAclEventContent,
},
RoomEventType, StateEventType,
},
int,
receipt::ReceiptType,
serde::{Base64, JsonObject, Raw},
signatures::{CanonicalJsonObject, CanonicalJsonValue},
state_res::{self, RoomVersion, StateMap},
to_device::DeviceIdOrAllDevices,
uint, EventId, MilliSecondsSinceUnixEpoch, RoomId, RoomVersionId, ServerName,
signatures::{CanonicalJsonValue},
to_device::DeviceIdOrAllDevices, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName,
ServerSigningKeyId,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use std::{
collections::{btree_map, hash_map, BTreeMap, BTreeSet, HashMap, HashSet},
collections::{BTreeMap},
fmt::Debug,
future::Future,
mem,
net::{IpAddr, SocketAddr},
ops::Deref,
pin::Pin,
sync::{Arc, RwLock, RwLockWriteGuard},
sync::{Arc, RwLock},
time::{Duration, Instant, SystemTime},
};
use tokio::sync::{MutexGuard, Semaphore};
use tracing::{debug, error, info, trace, warn};
use tracing::{info, warn};
/// Wraps either an literal IP address plus port, or a hostname plus complement
/// (colon-plus-port if it was specified).

View file

@ -1,13 +1,11 @@
use std::collections::HashMap;
use ruma::{
api::client::{error::ErrorKind, uiaa::UiaaInfo},
api::client::{error::ErrorKind},
events::{AnyEphemeralRoomEvent, RoomAccountDataEventType},
serde::Raw,
signatures::CanonicalJsonValue,
DeviceId, RoomId, UserId,
serde::Raw, RoomId, UserId,
};
use serde::{de::DeserializeOwned, Serialize};
use crate::{database::KeyValueDatabase, service, services, utils, Error, Result};

View file

@ -1,6 +1,6 @@
use ruma::{EventId, RoomId};
use std::collections::HashSet;
use std::fmt::Debug;
use std::sync::Arc;
use tokio::sync::MutexGuard;

View file

@ -5,7 +5,7 @@ use ruma::{
encryption::{CrossSigningKey, DeviceKeys, OneTimeKey},
events::{AnyToDeviceEvent, StateEventType},
serde::Raw,
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, MilliSecondsSinceUnixEpoch, MxcUri, RoomAliasId,
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, MilliSecondsSinceUnixEpoch, MxcUri,
UInt, UserId,
};
use tracing::warn;

View file

@ -3,16 +3,14 @@ pub mod key_value;
use crate::{
service::{
account_data, appservice, globals, key_backups, media, pusher,
rooms::{self, state_compressor::CompressedStateEvent},
sending, transaction_ids, uiaa, users,
rooms::{state_compressor::CompressedStateEvent},
},
services, utils, Config, Error, PduEvent, Result, Services, SERVICES,
};
use abstraction::KeyValueDatabaseEngine;
use abstraction::KvTree;
use directories::ProjectDirs;
use futures_util::{stream::FuturesUnordered, StreamExt};
use futures_util::{StreamExt};
use lru_cache::LruCache;
use ruma::{
events::{
@ -28,11 +26,10 @@ use std::{
fs::{self, remove_dir_all},
io::Write,
mem::size_of,
ops::Deref,
path::Path,
sync::{Arc, Mutex, RwLock},
};
use tokio::sync::{mpsc, OwnedRwLockReadGuard, RwLock as TokioRwLock, Semaphore};
use tokio::sync::{mpsc};
use tracing::{debug, error, info, warn};
pub struct KeyValueDatabase {

View file

@ -14,8 +14,7 @@ mod service;
mod utils;
use std::{
cell::Cell,
sync::{Arc, RwLock},
sync::{RwLock},
};
pub use api::ruma_wrapper::{Ruma, RumaResponse};

View file

@ -3,17 +3,14 @@ mod data;
pub use data::Data;
use ruma::{
api::client::error::ErrorKind,
events::{AnyEphemeralRoomEvent, RoomAccountDataEventType},
serde::Raw,
signatures::CanonicalJsonValue,
DeviceId, RoomId, UserId,
serde::Raw, RoomId, UserId,
};
use serde::{de::DeserializeOwned, Serialize};
use std::{collections::HashMap, sync::Arc};
use tracing::error;
use crate::{service::*, services, utils, Error, Result};
use std::{collections::HashMap, sync::Arc};
use crate::{Result};
pub struct Service {
db: Arc<dyn Data>,

View file

@ -26,12 +26,11 @@ use ruma::{
EventId, RoomAliasId, RoomId, RoomName, RoomVersionId, ServerName, UserId,
};
use serde_json::value::to_raw_value;
use tokio::sync::{mpsc, MutexGuard, RwLock, RwLockReadGuard};
use tokio::sync::{mpsc, MutexGuard};
use crate::{
api::{
client_server::{leave_all_rooms, AUTO_GEN_PASSWORD_LENGTH},
server_server,
},
services,
utils::{self, HtmlEscape},

View file

@ -2,15 +2,15 @@ mod data;
pub use data::Data;
use crate::api::server_server::FedDest;
use crate::service::*;
use crate::{utils, Config, Error, Result};
use crate::{Config, Error, Result};
use ruma::{
api::{
client::sync::sync_events,
federation::discovery::{ServerSigningKeys, VerifyKey},
},
DeviceId, EventId, MilliSecondsSinceUnixEpoch, RoomId, RoomVersionId, ServerName,
DeviceId, EventId, RoomId, RoomVersionId, ServerName,
ServerSigningKeyId, UserId,
};
use std::{

View file

@ -1,11 +1,10 @@
mod data;
pub use data::Data;
use crate::{services, utils, Error, Result};
use crate::{Result};
use ruma::{
api::client::{
backup::{BackupAlgorithm, KeyBackupData, RoomKeyBackup},
error::ErrorKind,
},
serde::Raw,
RoomId, UserId,

View file

@ -1,9 +1,9 @@
mod data;
pub use data::Data;
use crate::{services, utils, Error, Result};
use crate::{services, Result};
use image::{imageops::FilterType, GenericImageView};
use std::{mem, sync::Arc};
use std::{sync::Arc};
use tokio::{
fs::File,
io::{AsyncReadExt, AsyncWriteExt},

View file

@ -1,5 +1,5 @@
use std::{
collections::{BTreeMap, HashMap},
collections::{HashMap},
sync::{Arc, Mutex},
};

View file

@ -34,7 +34,7 @@ use ruma::{
state_res::{self, RoomVersion, StateMap},
uint, EventId, MilliSecondsSinceUnixEpoch, RoomId, ServerName, ServerSigningKeyId,
};
use serde_json::value::{to_raw_value, RawValue as RawJsonValue};
use serde_json::value::{RawValue as RawJsonValue};
use tracing::{debug, error, info, trace, warn};
use crate::{service::*, services, Error, PduEvent, Result};

View file

@ -4,7 +4,7 @@ use std::sync::Arc;
pub use data::Data;
use ruma::{events::StateEventType, EventId, RoomId};
use crate::{services, utils, Error, Result};
use crate::{Result};
pub struct Service {
db: Arc<dyn Data>,

View file

@ -2,21 +2,19 @@ mod data;
use std::{collections::HashSet, sync::Arc};
pub use data::Data;
use regex::Regex;
use ruma::{
events::{
direct::{DirectEvent, DirectEventContent},
direct::{DirectEvent},
ignored_user_list::IgnoredUserListEvent,
room::{create::RoomCreateEventContent, member::MembershipState},
tag::{TagEvent, TagEventContent},
AnyStrippedStateEvent, AnySyncStateEvent, GlobalAccountDataEventType, RoomAccountDataEvent,
RoomAccountDataEventContent, RoomAccountDataEventType, StateEventType,
AnyStrippedStateEvent, AnySyncStateEvent, GlobalAccountDataEventType, RoomAccountDataEventType, StateEventType,
},
serde::Raw,
RoomId, ServerName, UserId,
};
use crate::{services, utils, Error, Result};
use crate::{services, Error, Result};
pub struct Service {
db: Arc<dyn Data>,

View file

@ -1,9 +1,9 @@
mod data;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt::Debug;
use std::sync::{Arc, Mutex};
use std::{collections::HashSet, iter};
use std::{collections::HashSet};
pub use data::Data;
use regex::Regex;

View file

@ -13,7 +13,7 @@ use crate::{
};
use federation::transactions::send_transaction_message;
use futures_util::{stream::FuturesUnordered, StreamExt};
use ring::digest;
use ruma::{
api::{
appservice,
@ -33,7 +33,7 @@ use ruma::{
};
use tokio::{
select,
sync::{mpsc, RwLock, Semaphore},
sync::{mpsc, Semaphore},
};
use tracing::{error, warn};
@ -297,7 +297,7 @@ impl Service {
.sending
.servername_educount
.get(server.as_bytes())?
.map_or(Ok(0), |bytes| {
.map_or(Ok(0), |&bytes| {
utils::u64_from_bytes(&bytes)
.map_err(|_| Error::bad_database("Invalid u64 in servername_educount."))
})?;