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) {
let members: Vec<RoomMember> = joined_room.joined_members().await.ok().unwrap_or_default();
let to_username = |member: RoomMember| {
format!(
"@{}:{}",
member.user_id().localpart(),
member.user_id().server_name()
)
};
members.into_iter().map(to_username).collect()
members
.into_iter()
.map(|member| member.user_id().to_string())
.collect()
} else {
vec![]
}