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).