Browse Source

nth(0) -> next()

pull/80/head
jake 3 years ago
parent
commit
b374b63cba
  1. 7
      src/ship/packet/handler/trade.rs

7
src/ship/packet/handler/trade.rs

@ -40,13 +40,12 @@ where
{ {
let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?; let client = clients.get_mut(&id).ok_or(ShipError::ClientNotFound(id))?;
let inventory = item_manager.get_character_inventory_mut(&client.character)?; let inventory = item_manager.get_character_inventory_mut(&client.character)?;
let trade_partner = client_location.get_client_neighbors(id)?;
let trade_partner = trade_partner
.iter()
let trade_partner = client_location.get_client_neighbors(id)?
.into_iter()
.filter(|ac| { .filter(|ac| {
ac.local_client.id() == items_to_trade.trade_target ac.local_client.id() == items_to_trade.trade_target
}) })
.nth(0)
.next()
.ok_or(TradeError::CouldNotFindTradePartner)?; .ok_or(TradeError::CouldNotFindTradePartner)?;

Loading…
Cancel
Save