Remove useless serde roundtrips
This commit is contained in:
parent
5a99460a4c
commit
27692a2f14
2 changed files with 3 additions and 37 deletions
|
@ -149,19 +149,7 @@ pub(crate) async fn get_public_rooms_filtered_helper(
|
|||
.await?;
|
||||
|
||||
return Ok(get_public_rooms_filtered::Response {
|
||||
chunk: response
|
||||
.chunk
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
||||
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")
|
||||
})
|
||||
.collect(),
|
||||
chunk: response.chunk,
|
||||
prev_batch: response.prev_batch,
|
||||
next_batch: response.next_batch,
|
||||
total_room_count_estimate: response.total_room_count_estimate,
|
||||
|
|
|
@ -591,18 +591,7 @@ pub async fn get_public_rooms_filtered_route(
|
|||
.await?;
|
||||
|
||||
Ok(get_public_rooms_filtered::v1::Response {
|
||||
chunk: response
|
||||
.chunk
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
||||
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")
|
||||
})
|
||||
.collect(),
|
||||
chunk: response.chunk,
|
||||
prev_batch: response.prev_batch,
|
||||
next_batch: response.next_batch,
|
||||
total_room_count_estimate: response.total_room_count_estimate,
|
||||
|
@ -631,18 +620,7 @@ pub async fn get_public_rooms_route(
|
|||
.await?;
|
||||
|
||||
Ok(get_public_rooms::v1::Response {
|
||||
chunk: response
|
||||
.chunk
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
// Convert ruma::api::federation::directory::get_public_rooms::v1::PublicRoomsChunk
|
||||
// to ruma::api::client::r0::directory::PublicRoomsChunk
|
||||
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")
|
||||
})
|
||||
.collect(),
|
||||
chunk: response.chunk,
|
||||
prev_batch: response.prev_batch,
|
||||
next_batch: response.next_batch,
|
||||
total_room_count_estimate: response.total_room_count_estimate,
|
||||
|
|
Loading…
Add table
Reference in a new issue