run nightly cargo fmt again

Signed-off-by: June Clementine Strawberry <june@3.dog>
This commit is contained in:
June Clementine Strawberry 2025-03-02 23:15:05 -05:00
parent 17e0384eeb
commit de53ad83b2
No known key found for this signature in database
11 changed files with 45 additions and 28 deletions

View file

@ -66,10 +66,11 @@ pub(super) async fn reprocess(
format!("#{}:{}", room_alias_localpart, services.globals.server_name()); format!("#{}:{}", room_alias_localpart, services.globals.server_name());
let room_alias = match OwnedRoomAliasId::parse(room_alias_str) { let room_alias = match OwnedRoomAliasId::parse(room_alias_str) {
| Ok(alias) => alias, | Ok(alias) => alias,
| Err(err) => | Err(err) => {
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to parse alias: {err}" "Failed to parse alias: {err}"
))), )));
},
}; };
match command { match command {
| RoomAliasCommand::Set { force, room_id, .. } => { | RoomAliasCommand::Set { force, room_id, .. } => {

View file

@ -96,12 +96,13 @@ async fn ban_room(
let room_id = if room.is_room_id() { let room_id = if room.is_room_id() {
let room_id = match RoomId::parse(&room) { let room_id = match RoomId::parse(&room) {
| Ok(room_id) => room_id, | Ok(room_id) => room_id,
| Err(e) => | Err(e) => {
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to parse room ID {room}. Please note that this requires a full room \ "Failed to parse room ID {room}. Please note that this requires a full room \
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \ ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
(`#roomalias:example.com`): {e}" (`#roomalias:example.com`): {e}"
))), )));
},
}; };
debug!("Room specified is a room ID, banning room ID"); debug!("Room specified is a room ID, banning room ID");
@ -111,12 +112,13 @@ async fn ban_room(
} else if room.is_room_alias_id() { } else if room.is_room_alias_id() {
let room_alias = match RoomAliasId::parse(&room) { let room_alias = match RoomAliasId::parse(&room) {
| Ok(room_alias) => room_alias, | Ok(room_alias) => room_alias,
| Err(e) => | Err(e) => {
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to parse room ID {room}. Please note that this requires a full room \ "Failed to parse room ID {room}. Please note that this requires a full room \
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \ ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
(`#roomalias:example.com`): {e}" (`#roomalias:example.com`): {e}"
))), )));
},
}; };
debug!( debug!(
@ -514,12 +516,13 @@ async fn unban_room(
let room_id = if room.is_room_id() { let room_id = if room.is_room_id() {
let room_id = match RoomId::parse(&room) { let room_id = match RoomId::parse(&room) {
| Ok(room_id) => room_id, | Ok(room_id) => room_id,
| Err(e) => | Err(e) => {
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to parse room ID {room}. Please note that this requires a full room \ "Failed to parse room ID {room}. Please note that this requires a full room \
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \ ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
(`#roomalias:example.com`): {e}" (`#roomalias:example.com`): {e}"
))), )));
},
}; };
debug!("Room specified is a room ID, unbanning room ID"); debug!("Room specified is a room ID, unbanning room ID");
@ -529,12 +532,13 @@ async fn unban_room(
} else if room.is_room_alias_id() { } else if room.is_room_alias_id() {
let room_alias = match RoomAliasId::parse(&room) { let room_alias = match RoomAliasId::parse(&room) {
| Ok(room_alias) => room_alias, | Ok(room_alias) => room_alias,
| Err(e) => | Err(e) => {
return Ok(RoomMessageEventContent::text_plain(format!( return Ok(RoomMessageEventContent::text_plain(format!(
"Failed to parse room ID {room}. Please note that this requires a full room \ "Failed to parse room ID {room}. Please note that this requires a full room \
ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \ ID (`!awIh6gGInaS5wLQJwa:example.com`) or a room alias \
(`#roomalias:example.com`): {e}" (`#roomalias:example.com`): {e}"
))), )));
},
}; };
debug!( debug!(

View file

@ -267,8 +267,9 @@ pub(crate) async fn get_public_rooms_filtered_helper(
let backwards = match characters.next() { let backwards = match characters.next() {
| Some('n') => false, | Some('n') => false,
| Some('p') => true, | Some('p') => true,
| _ => | _ => {
return Err(Error::BadRequest(ErrorKind::InvalidParam, "Invalid `since` token")), return Err(Error::BadRequest(ErrorKind::InvalidParam, "Invalid `since` token"));
},
}; };
num_since = characters num_since = characters

View file

@ -197,11 +197,12 @@ pub(crate) async fn create_receipt_route(
.read_receipt .read_receipt
.private_read_set(&body.room_id, sender_user, count); .private_read_set(&body.room_id, sender_user, count);
}, },
| _ => | _ => {
return Err!(Request(InvalidParam(warn!( return Err!(Request(InvalidParam(warn!(
"Received unknown read receipt type: {}", "Received unknown read receipt type: {}",
&body.receipt_type &body.receipt_type
)))), ))));
},
} }
Ok(create_receipt::v3::Response {}) Ok(create_receipt::v3::Response {})

View file

@ -32,8 +32,9 @@ pub(crate) async fn get_hierarchy_route(
{ {
| None => Err!(Request(NotFound("The requested room was not found"))), | None => Err!(Request(NotFound("The requested room was not found"))),
| Some(SummaryAccessibility::Inaccessible) => | Some(SummaryAccessibility::Inaccessible) => {
Err!(Request(NotFound("The requested room is inaccessible"))), Err!(Request(NotFound("The requested room is inaccessible")))
},
| Some(SummaryAccessibility::Accessible(room)) => { | Some(SummaryAccessibility::Accessible(room)) => {
let (children, inaccessible_children) = let (children, inaccessible_children) =

View file

@ -682,7 +682,7 @@ fn valid_membership_change(
} }
allow allow
}, },
| _ => | _ => {
if !sender_is_joined if !sender_is_joined
|| target_user_current_membership == MembershipState::Join || target_user_current_membership == MembershipState::Join
|| target_user_current_membership == MembershipState::Ban || target_user_current_membership == MembershipState::Ban
@ -706,6 +706,7 @@ fn valid_membership_change(
); );
} }
allow allow
}
}, },
} }
}, },

View file

@ -61,8 +61,12 @@ pub(crate) fn build(services: &Arc<Services>) -> Result<(Router, Guard)> {
) )
.layer(axum::middleware::from_fn_with_state(Arc::clone(services), request::handle)) .layer(axum::middleware::from_fn_with_state(Arc::clone(services), request::handle))
.layer(SecureClientIpSource::ConnectInfo.into_extension()) .layer(SecureClientIpSource::ConnectInfo.into_extension())
.layer(ResponseBodyTimeoutLayer::new(Duration::from_secs(server.config.client_response_timeout))) .layer(ResponseBodyTimeoutLayer::new(Duration::from_secs(
.layer(RequestBodyTimeoutLayer::new(Duration::from_secs(server.config.client_receive_timeout))) server.config.client_response_timeout,
)))
.layer(RequestBodyTimeoutLayer::new(Duration::from_secs(
server.config.client_receive_timeout,
)))
.layer(TimeoutLayer::new(Duration::from_secs(server.config.client_request_timeout))) .layer(TimeoutLayer::new(Duration::from_secs(server.config.client_request_timeout)))
.layer(SetResponseHeaderLayer::if_not_present( .layer(SetResponseHeaderLayer::if_not_present(
HeaderName::from_static("origin-agent-cluster"), // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster HeaderName::from_static("origin-agent-cluster"), // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin-Agent-Cluster

View file

@ -58,10 +58,11 @@ pub(super) async fn fetch_state(
| hash_map::Entry::Vacant(v) => { | hash_map::Entry::Vacant(v) => {
v.insert(pdu.event_id.clone()); v.insert(pdu.event_id.clone());
}, },
| hash_map::Entry::Occupied(_) => | hash_map::Entry::Occupied(_) => {
return Err!(Database( return Err!(Database(
"State event's type and state_key combination exists multiple times.", "State event's type and state_key combination exists multiple times.",
)), ));
},
} }
} }

View file

@ -56,10 +56,11 @@ pub(super) async fn handle_outlier_pdu<'a>(
obj obj
}, },
| Err(e) => | Err(e) => {
return Err!(Request(InvalidParam(debug_error!( return Err!(Request(InvalidParam(debug_error!(
"Signature verification failed for {event_id}: {e}" "Signature verification failed for {event_id}: {e}"
)))), ))));
},
}; };
// Now that we have checked the signature and hashes we can add the eventID and // Now that we have checked the signature and hashes we can add the eventID and

View file

@ -109,7 +109,7 @@ pub async fn get_summary_and_children_local(
{ {
| None => (), // cache miss | None => (), // cache miss
| Some(None) => return Ok(None), | Some(None) => return Ok(None),
| Some(Some(cached)) => | Some(Some(cached)) => {
return Ok(Some( return Ok(Some(
if self if self
.is_accessible_child( .is_accessible_child(
@ -124,7 +124,8 @@ pub async fn get_summary_and_children_local(
} else { } else {
SummaryAccessibility::Inaccessible SummaryAccessibility::Inaccessible
}, },
)), ));
},
} }
let children_pdus: Vec<_> = self let children_pdus: Vec<_> = self

View file

@ -18,8 +18,9 @@ pub async fn get_event_keys(
let required = match required_keys(object, version) { let required = match required_keys(object, version) {
| Ok(required) => required, | Ok(required) => required,
| Err(e) => | Err(e) => {
return Err!(BadServerResponse("Failed to determine keys required to verify: {e}")), return Err!(BadServerResponse("Failed to determine keys required to verify: {e}"));
},
}; };
let batch = required let batch = required