remove two unnecessary matches

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-04-12 19:50:30 -04:00 committed by June
parent e5307d44ca
commit 0d21d70d4a
2 changed files with 20 additions and 19 deletions

View file

@ -131,18 +131,22 @@ pub async fn get_context_route(body: Ruma<get_context::v3::Request>) -> Result<g
} }
} }
let shortstatehash = match services().rooms.state_accessor.pdu_shortstatehash( let shortstatehash = services()
events_after .rooms
.last() .state_accessor
.map_or(&*body.event_id, |(_, e)| &*e.event_id), .pdu_shortstatehash(
)? { events_after
Some(s) => s, .last()
None => services() .map_or(&*body.event_id, |(_, e)| &*e.event_id),
.rooms )?
.state .map_or(
.get_room_shortstatehash(&room_id)? services()
.expect("All rooms have state"), .rooms
}; .state
.get_room_shortstatehash(&room_id)?
.expect("All rooms have state"),
|hash| hash,
);
let state_ids = services() let state_ids = services()
.rooms .rooms

View file

@ -50,22 +50,19 @@ where
let url = reqwest_request.url().clone(); let url = reqwest_request.url().clone();
let mut response = match services() let mut response = services()
.globals .globals
.client .client
.appservice .appservice
.execute(reqwest_request) .execute(reqwest_request)
.await .await
{ .map_err(|e| {
Ok(r) => r,
Err(e) => {
warn!( warn!(
"Could not send request to appservice {} at {}: {}", "Could not send request to appservice {} at {}: {}",
registration.id, destination, e registration.id, destination, e
); );
return Err(e.into()); e
}, })?;
};
// reqwest::Response -> http::Response conversion // reqwest::Response -> http::Response conversion
let status = response.status(); let status = response.status();