remove unnecessary clone from into_iter

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-03-27 14:47:17 -04:00 committed by June
parent 6aaf169c45
commit 92dbe82675

View file

@ -135,15 +135,13 @@ pub(crate) async fn get_alias_helper(room_alias: OwnedRoomAliasId) -> Result<get
// prefer the very first server to be ourselves if available, else prefer the
// room alias server first
if let Some(server_index) = servers
.clone()
.into_iter()
.iter()
.position(|server| server == services().globals.server_name())
{
servers.remove(server_index);
servers.insert(0, services().globals.server_name().to_owned());
} else if let Some(alias_server_index) = servers
.clone()
.into_iter()
.iter()
.position(|server| server == room_alias.server_name())
{
servers.remove(alias_server_index);
@ -210,8 +208,7 @@ pub(crate) async fn get_alias_helper(room_alias: OwnedRoomAliasId) -> Result<get
// insert our server as the very first choice if in list
if let Some(server_index) = servers
.clone()
.into_iter()
.iter()
.position(|server| server == services().globals.server_name())
{
servers.remove(server_index);