Remove unnecessary Option-wrapping and successive unwrapping

This commit is contained in:
Jonas Platte 2021-06-17 20:44:29 +02:00
parent b291e76572
commit 808741bcb6
No known key found for this signature in database
GPG key ID: CC154DE0E30B7C67
3 changed files with 33 additions and 50 deletions

View file

@ -160,15 +160,12 @@ pub async fn get_public_rooms_filtered_helper(
.map(|c| {
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
// to ruma::api::client::r0::directory::PublicRoomsChunk
Ok::<_, Error>(
serde_json::from_str(
&serde_json::to_string(&c)
.expect("PublicRoomsChunk::to_string always works"),
)
.expect("federation and client-server PublicRoomsChunk are the same type"),
serde_json::from_str(
&serde_json::to_string(&c)
.expect("PublicRoomsChunk::to_string always works"),
)
.expect("federation and client-server PublicRoomsChunk are the same type")
})
.filter_map(|r| r.ok())
.collect(),
prev_batch: response.prev_batch,
next_batch: response.next_batch,