chore: Clippy fixes

This commit is contained in:
Ginger
2026-05-26 13:49:17 -04:00
committed by Ellis Git
parent 74841b6711
commit 30c9d6d2df
6 changed files with 12 additions and 17 deletions
+2 -5
View File
@@ -109,10 +109,7 @@ pub(crate) async fn change_password_route(
ClientIp(client): ClientIp, ClientIp(client): ClientIp,
body: Ruma<change_password::v3::Request>, body: Ruma<change_password::v3::Request>,
) -> Result<change_password::v3::Response> { ) -> Result<change_password::v3::Response> {
let identity = if let Some(user_id) = body let identity = if let Some(user_id) = body.identity.as_ref().map(ClientIdentity::sender_user)
.identity
.as_ref()
.map(|identity| identity.sender_user())
{ {
// A signed-in user is trying to change their password, prompt them for their // A signed-in user is trying to change their password, prompt them for their
// existing one // existing one
@@ -282,7 +279,7 @@ pub(crate) async fn deactivate_route(
let sender_user = body let sender_user = body
.identity .identity
.as_ref() .as_ref()
.map(|identity| identity.sender_user()) .map(ClientIdentity::sender_user)
.ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?; .ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?;
// Prompt the user to confirm with their password using UIAA // Prompt the user to confirm with their password using UIAA
+2 -2
View File
@@ -13,7 +13,7 @@ use ruma::{
}; };
use service::{mailer::messages, uiaa::Identity}; use service::{mailer::messages, uiaa::Identity};
use crate::Ruma; use crate::{Ruma, router::ClientIdentity};
/// # `GET _matrix/client/v3/account/3pid` /// # `GET _matrix/client/v3/account/3pid`
/// ///
@@ -58,7 +58,7 @@ pub(crate) async fn request_3pid_management_token_via_email_route(
let sender_user = body let sender_user = body
.identity .identity
.as_ref() .as_ref()
.map(|identity| identity.sender_user()) .map(ClientIdentity::sender_user)
.ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?; .ok_or_else(|| err!(Request(MissingToken("Missing access token."))))?;
if !services.threepid.email_requirement().may_change() { if !services.threepid.email_requirement().may_change() {
+2 -4
View File
@@ -4,7 +4,7 @@ use conduwuit::{Err, Result};
use ruma::api::client::room::get_summary; use ruma::api::client::room::get_summary;
use service::rooms::summary::Accessibility; use service::rooms::summary::Accessibility;
use crate::Ruma; use crate::{Ruma, router::ClientIdentity};
/// # `GET /_matrix/client/v1/room_summary/{roomIdOrAlias}` /// # `GET /_matrix/client/v1/room_summary/{roomIdOrAlias}`
/// ///
@@ -29,9 +29,7 @@ pub(crate) async fn get_room_summary(
.rooms .rooms
.summary .summary
.get_room_summary_for_user( .get_room_summary_for_user(
body.identity body.identity.as_ref().map(ClientIdentity::sender_user),
.as_ref()
.map(|identity| identity.sender_user()),
&room_id, &room_id,
&servers, &servers,
) )
+1 -1
View File
@@ -93,7 +93,7 @@ pub(crate) async fn sync_events_v5_route(
.and_then(|string| string.parse().ok()) .and_then(|string| string.parse().ok())
.unwrap_or(0); .unwrap_or(0);
let snake_key = into_snake_key(sender_user.as_ref(), sender_device.as_str(), conn_id); let snake_key = into_snake_key(sender_user, sender_device.as_str(), conn_id);
if globalsince != 0 && !services.sync.snake_connection_cached(&snake_key) { if globalsince != 0 && !services.sync.snake_connection_cached(&snake_key) {
return Err!(Request(UnknownPos( return Err!(Request(UnknownPos(
+4 -4
View File
@@ -28,7 +28,7 @@ pub(crate) enum ClientIdentity {
Appservice { Appservice {
sender_user: OwnedUserId, sender_user: OwnedUserId,
sender_device: Option<OwnedDeviceId>, sender_device: Option<OwnedDeviceId>,
appservice_info: RegistrationInfo, appservice_info: Box<RegistrationInfo>,
}, },
} }
@@ -49,7 +49,7 @@ impl ClientIdentity {
pub(crate) fn expect_sender_device(&self) -> Result<&DeviceId> { pub(crate) fn expect_sender_device(&self) -> Result<&DeviceId> {
self.sender_device().ok_or_else(|| { self.sender_device().ok_or_else(|| {
err!(Request(Forbidden("Appservices must masquerade to use this endpoint"))) err!(Request(Forbidden("Appservices must masquerade to use this endpoint.")))
}) })
} }
@@ -212,10 +212,10 @@ impl CheckAuth for AccessToken {
Ok(ClientIdentity::Appservice { Ok(ClientIdentity::Appservice {
sender_user, sender_user,
sender_device, sender_device,
appservice_info, appservice_info: Box::new(appservice_info),
}) })
} else { } else {
return Err!(Request(Unauthorized("Invalid access token."))); Err!(Request(Unauthorized("Invalid access token.")))
} }
} }
} }
+1 -1
View File
@@ -80,7 +80,7 @@ pub(crate) async fn send_transaction_message_route(
))); )));
} }
let txn_key = (body.identity.to_owned(), body.transaction_id.clone()); let txn_key = (body.identity.clone(), body.transaction_id.clone());
// Atomically check cache, join active, or start new transaction // Atomically check cache, join active, or start new transaction
match services match services