chore: bump rust

and fix new lints that come with it
This commit is contained in:
Matthias Ahouansou 2024-05-05 13:11:44 +01:00
parent 79c4bb17ca
commit 256dae983b
No known key found for this signature in database
21 changed files with 43 additions and 46 deletions

View file

@ -80,12 +80,12 @@ pub struct Service {
/// Handles "rotation" of long-polling requests. "Rotation" in this context is similar to "rotation" of log files and the like.
///
/// This is utilized to have sync workers return early and release read locks on the database.
pub struct RotationHandler(broadcast::Sender<()>, broadcast::Receiver<()>);
pub struct RotationHandler(broadcast::Sender<()>);
impl RotationHandler {
pub fn new() -> Self {
let (s, r) = broadcast::channel(1);
Self(s, r)
let s = broadcast::channel(1).0;
Self(s)
}
pub fn watch(&self) -> impl Future<Output = ()> {

View file

@ -44,13 +44,13 @@ impl Service {
}
#[tracing::instrument(skip(self, destination, request))]
pub async fn send_request<T: OutgoingRequest>(
pub async fn send_request<T>(
&self,
destination: &str,
request: T,
) -> Result<T::IncomingResponse>
where
T: Debug,
T: OutgoingRequest + Debug,
{
let destination = destination.replace("/_matrix/push/v1/notify", "");
@ -231,11 +231,11 @@ impl Service {
let mut device = Device::new(pusher.ids.app_id.clone(), pusher.ids.pushkey.clone());
device.data.default_payload = http.default_payload.clone();
device.data.format = http.format.clone();
device.data.format.clone_from(&http.format);
// Tweaks are only added if the format is NOT event_id_only
if !event_id_only {
device.tweaks = tweaks.clone();
device.tweaks.clone_from(&tweaks);
}
let d = vec![device];

View file

@ -482,7 +482,7 @@ impl Service {
match join_rule {
JoinRule::Restricted(r) => {
for rule in &r.allow {
if let join_rules::AllowRule::RoomMembership(rm) = rule {
if let AllowRule::RoomMembership(rm) = rule {
if let Ok(true) = services()
.rooms
.state_cache

View file

@ -675,13 +675,13 @@ impl Service {
}
#[tracing::instrument(skip(self, destination, request))]
pub async fn send_federation_request<T: OutgoingRequest>(
pub async fn send_federation_request<T>(
&self,
destination: &ServerName,
request: T,
) -> Result<T::IncomingResponse>
where
T: Debug,
T: OutgoingRequest + Debug,
{
debug!("Waiting for permit");
let permit = self.maximum_requests.acquire().await;
@ -704,13 +704,13 @@ impl Service {
///
/// Only returns None if there is no url specified in the appservice registration file
#[tracing::instrument(skip(self, registration, request))]
pub async fn send_appservice_request<T: OutgoingRequest>(
pub async fn send_appservice_request<T>(
&self,
registration: Registration,
request: T,
) -> Result<Option<T::IncomingResponse>>
where
T: Debug,
T: OutgoingRequest + Debug,
{
let permit = self.maximum_requests.acquire().await;
let response = appservice_server::send_request(registration, request).await;

View file

@ -86,11 +86,12 @@ impl Service {
for (list_id, list) in &mut request.lists {
if let Some(cached_list) = cached.lists.get(list_id) {
if list.sort.is_empty() {
list.sort = cached_list.sort.clone();
list.sort.clone_from(&cached_list.sort);
};
if list.room_details.required_state.is_empty() {
list.room_details.required_state =
cached_list.room_details.required_state.clone();
list.room_details
.required_state
.clone_from(&cached_list.room_details.required_state);
};
list.room_details.timeline_limit = list
.room_details
@ -132,7 +133,8 @@ impl Service {
(_, _) => {}
}
if list.bump_event_types.is_empty() {
list.bump_event_types = cached_list.bump_event_types.clone();
list.bump_event_types
.clone_from(&cached_list.bump_event_types);
};
}
cached.lists.insert(list_id.clone(), list.clone());