diff --git a/src/api/client_server/alias.rs b/src/api/client_server/alias.rs index bee9fed6..fbb1d8cc 100644 --- a/src/api/client_server/alias.rs +++ b/src/api/client_server/alias.rs @@ -247,13 +247,13 @@ fn room_available_servers( .iter() .position(|server_name| server_is_ours(server_name)) { - servers.remove(server_index); + servers.swap_remove(server_index); servers.insert(0, services().globals.server_name().to_owned()); } else if let Some(alias_server_index) = servers .iter() .position(|server| server == room_alias.server_name()) { - servers.remove(alias_server_index); + servers.swap_remove(alias_server_index); servers.insert(0, room_alias.server_name().into()); } diff --git a/src/api/server_server.rs b/src/api/server_server.rs index 277c971d..f966bdbf 100644 --- a/src/api/server_server.rs +++ b/src/api/server_server.rs @@ -1922,7 +1922,7 @@ pub(crate) async fn get_room_information_route( .iter() .position(|server| server == services().globals.server_name()) { - servers.remove(server_index); + servers.swap_remove(server_index); servers.insert(0, services().globals.server_name().to_owned()); } diff --git a/src/service/rooms/timeline/mod.rs b/src/service/rooms/timeline/mod.rs index 6c534b4b..b45b2a3b 100644 --- a/src/service/rooms/timeline/mod.rs +++ b/src/service/rooms/timeline/mod.rs @@ -1078,7 +1078,7 @@ impl Service { .into_iter() .position(|server_name| server_is_ours(&server_name)) { - servers.remove(server_index); + servers.swap_remove(server_index); } servers.sort_unstable();