fix lints for upcoming 1.88.0 toolchain

This commit is contained in:
Charles Hall 2025-07-21 09:33:01 -07:00
parent fa6fb37a2c
commit 595f35b673
19 changed files with 41 additions and 42 deletions

View file

@ -198,7 +198,7 @@ pub(crate) async fn register_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
@ -213,7 +213,7 @@ pub(crate) async fn register_route(
&uiaainfo,
&json,
)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}
@ -346,13 +346,13 @@ pub(crate) async fn change_password_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
services().uiaa.create(sender_user, sender_device, &uiaainfo, &json)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}
@ -434,13 +434,13 @@ pub(crate) async fn deactivate_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
services().uiaa.create(sender_user, sender_device, &uiaainfo, &json)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}

View file

@ -164,7 +164,7 @@ pub(crate) async fn get_alias_helper(
}
}
}
};
}
let Some(room_id) = room_id else {
return Err(Error::BadRequest(

View file

@ -107,13 +107,13 @@ pub(crate) async fn delete_device_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
services().uiaa.create(sender_user, sender_device, &uiaainfo, &json)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}
@ -161,13 +161,13 @@ pub(crate) async fn delete_devices_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
services().uiaa.create(sender_user, sender_device, &uiaainfo, &json)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}

View file

@ -135,13 +135,13 @@ pub(crate) async fn upload_signing_keys_route(
&uiaainfo,
)?;
if !worked {
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
}
// Success!
} else if let Some(json) = body.json_body {
uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH));
services().uiaa.create(sender_user, sender_device, &uiaainfo, &json)?;
return Err(Error::Uiaa(uiaainfo));
return Err(Error::Uiaa(Box::new(uiaainfo)));
} else {
return Err(Error::BadRequest(ErrorKind::NotJson, "Not json."));
}

View file

@ -26,14 +26,14 @@ pub(crate) async fn report_event_route(
ErrorKind::InvalidParam,
"Invalid score, must be within 0 to -100",
));
};
}
if let Some(true) = body.reason.clone().map(|s| s.chars().count() > 250) {
return Err(Error::BadRequest(
ErrorKind::InvalidParam,
"Reason too long, should be 250 characters or fewer",
));
};
}
services().admin.send_message(message::RoomMessageEventContent::text_html(
format!(

View file

@ -263,7 +263,7 @@ async fn ar_from_request_inner(
if let Some(json_body) = &json_body {
request_map.insert("content".to_owned(), json_body.clone());
};
}
let keys_result = services()
.rooms

View file

@ -217,7 +217,7 @@ where
serde_json::from_slice(http_request.body())
.expect("body is valid json, we just created it"),
);
};
}
request_map
.insert("method".to_owned(), T::METADATA.method.to_string().into());

View file

@ -54,6 +54,6 @@ impl Watchers {
tx.0.send(()).expect("channel should still be open");
}
}
};
}
}
}

View file

@ -72,7 +72,7 @@ fn set_application_state(state: ApplicationState) {
]);
}
ApplicationState::Stopping => notify(&[NotifyState::Stopping]),
};
}
}
}

View file

@ -246,7 +246,7 @@ impl TracingFilterCommand {
#[derive(Debug)]
pub(crate) enum AdminRoomEvent {
ProcessMessage(String),
SendMessage(RoomMessageEventContent),
SendMessage(Box<RoomMessageEventContent>),
}
pub(crate) struct Service {
@ -297,7 +297,7 @@ impl Service {
grapevine_room: &OwnedRoomId,
) {
let message_content = match event {
AdminRoomEvent::SendMessage(content) => content,
AdminRoomEvent::SendMessage(content) => *content,
AdminRoomEvent::ProcessMessage(room_message) => {
self.process_admin_message(room_message).await
}
@ -343,7 +343,9 @@ impl Service {
&self,
message_content: RoomMessageEventContent,
) {
self.sender.send(AdminRoomEvent::SendMessage(message_content)).unwrap();
self.sender
.send(AdminRoomEvent::SendMessage(Box::new(message_content)))
.unwrap();
}
// Parse and process a message from the admin room
@ -701,7 +703,7 @@ impl Service {
return Ok(RoomMessageEventContent::text_plain(
"The specified user is not from this server!",
));
};
}
// Check if the specified user is valid
if !services().users.exists(&user_id)?
@ -1234,7 +1236,7 @@ impl Service {
return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to reload filter: {e}"
)));
};
}
return Ok(RoomMessageEventContent::text_plain(
"Filter reloaded",

View file

@ -329,7 +329,7 @@ impl Service {
error!(config=?s.config.default_room_version, fallback=?crate::config::default_default_room_version(), "Room version in config isn't supported, falling back to default version");
s.config.default_room_version =
crate::config::default_default_room_version();
};
}
Ok(s)
}
@ -526,7 +526,7 @@ impl Service {
Grapevine user",
);
}
};
}
}
pub(crate) fn supported_room_versions(&self) -> Vec<RoomVersionId> {

View file

@ -157,7 +157,7 @@ impl Service {
if i % 100 == 0 {
tokio::task::yield_now().await;
}
};
}
}
debug!(
chunk_cache_length = ?chunk_cache.len(),

View file

@ -1126,10 +1126,7 @@ impl Service {
services()
.rooms
.auth_chain
.get_auth_chain(
room_id,
state.iter().map(|(_, id)| id.clone()).collect(),
)
.get_auth_chain(room_id, state.values().cloned().collect())
.await?
.collect(),
);

View file

@ -155,7 +155,7 @@ impl Service {
.invalidate_cache(&pdu.room_id)
.await;
}
_ => continue,
_ => {}
}
}

View file

@ -257,7 +257,7 @@ impl Service {
)?;
return Ok(());
};
}
// Else we have two options.
// 1. We add the current diff on top of the parent layer.
@ -374,7 +374,7 @@ impl Service {
2,
states_parents,
)?;
};
}
Ok((new_shortstatehash, statediffnew, statediffremoved))
}

View file

@ -442,7 +442,7 @@ impl Service {
highlight = true;
}
_ => {}
};
}
}
if notify {
@ -497,7 +497,7 @@ impl Service {
)? {
self.redact_pdu(redact_id, pdu, shortroomid)?;
}
};
}
}
TimelineEventType::SpaceChild => {
if pdu.state_key.is_some() {

View file

@ -96,12 +96,12 @@ impl Service {
if let Some(cached_list) = cached.lists.get(list_id) {
if list.sort.is_empty() {
list.sort.clone_from(&cached_list.sort);
};
}
if list.room_details.required_state.is_empty() {
list.room_details
.required_state
.clone_from(&cached_list.room_details.required_state);
};
}
list.room_details.timeline_limit = list
.room_details
.timeline_limit
@ -151,7 +151,7 @@ impl Service {
if list.bump_event_types.is_empty() {
list.bump_event_types
.clone_from(&cached_list.bump_event_types);
};
}
}
cached.lists.insert(list_id.clone(), list.clone());
}

View file

@ -66,7 +66,7 @@ pub(crate) enum Error {
/// Don't create this directly. Use [`Error::bad_database`] instead.
BadDatabase(&'static str),
#[error("uiaa")]
Uiaa(UiaaInfo),
Uiaa(Box<UiaaInfo>),
#[error("{}: {}", .0.errcode(), .1)]
BadRequest(ErrorKind, &'static str),
// This is only needed for when a room alias already exists
@ -106,7 +106,7 @@ impl Error {
};
if let Self::Uiaa(uiaainfo) = self {
return Ra(UiaaResponse::AuthResponse(uiaainfo.clone()));
return Ra(UiaaResponse::AuthResponse(*uiaainfo.clone()));
}
if let Self::Federation(origin, error) = self {

View file

@ -201,7 +201,7 @@ impl<K> Drop for EntryDropGuard<K> {
.send(self.key.take().expect("drop should only be called once"))
{
warn!(%error, "Failed to send cleanup message");
};
}
}
}