Get user list: replace format! with direct string conversion.

This commit is contained in:
projectmoon 2021-02-10 20:18:47 +00:00
parent d813198cb0
commit 7e23f80e42
1 changed files with 4 additions and 9 deletions

View File

@ -28,15 +28,10 @@ pub async fn get_users_in_room(client: &Client, room_id: &RoomId) -> Vec<String>
if let Some(joined_room) = client.get_joined_room(room_id) { if let Some(joined_room) = client.get_joined_room(room_id) {
let members: Vec<RoomMember> = joined_room.joined_members().await.ok().unwrap_or_default(); let members: Vec<RoomMember> = joined_room.joined_members().await.ok().unwrap_or_default();
let to_username = |member: RoomMember| { members
format!( .into_iter()
"@{}:{}", .map(|member| member.user_id().to_string())
member.user_id().localpart(), .collect()
member.user_id().server_name()
)
};
members.into_iter().map(to_username).collect()
} else { } else {
vec![] vec![]
} }