From d63662fc6a3ceac46d1bedd9142c8c61c7aec6c6 Mon Sep 17 00:00:00 2001 From: jake Date: Fri, 18 Jun 2021 11:53:23 -0600 Subject: [PATCH] lint src/ship/packet/builder/ship.rs --- src/ship/packet/builder/ship.rs | 2 +- src/ship/packet/handler/ship.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ship/packet/builder/ship.rs b/src/ship/packet/builder/ship.rs index c80d562..8b3e40f 100644 --- a/src/ship/packet/builder/ship.rs +++ b/src/ship/packet/builder/ship.rs @@ -13,7 +13,7 @@ use crate::common::interserver::Ship; use libpso::packet::ship::BLOCK_MENU_ID; use crate::login::character::SHIP_MENU_ID; -pub fn ship_list(ships: &Vec) -> ShipList { +pub fn ship_list(ships: &[Ship]) -> ShipList { let ships = ships.iter() .enumerate() .map(|(i, ship)| { diff --git a/src/ship/packet/handler/ship.rs b/src/ship/packet/handler/ship.rs index 9916901..0a0c0cd 100644 --- a/src/ship/packet/handler/ship.rs +++ b/src/ship/packet/handler/ship.rs @@ -2,10 +2,10 @@ use libpso::packet::ship::*; use libpso::packet::login::RedirectClient; use crate::common::serverstate::ClientId; use crate::common::interserver::Ship; -use crate::ship::ship::{SendShipPacket, ShipError, Clients}; +use crate::ship::ship::{SendShipPacket, ShipError}; use crate::ship::packet::builder; -pub fn ship_list(id: ClientId, ship_list: &Vec) +pub fn ship_list(id: ClientId, ship_list: &[Ship]) -> Box + Send> { Box::new(vec![(id, SendShipPacket::ShipList(builder::ship::ship_list(ship_list)))].into_iter()) } @@ -15,7 +15,7 @@ pub fn block_list(id: ClientId, shipname: &str, num_blocks: usize) Box::new(vec![(id, SendShipPacket::ShipBlockList(ShipBlockList::new(shipname, num_blocks)))].into_iter()) } -pub fn selected_ship(id: ClientId, menuselect: &MenuSelect, ship_list: &Vec) +pub fn selected_ship(id: ClientId, menuselect: &MenuSelect, ship_list: &[Ship]) -> Result + Send>, ShipError> { let ship = ship_list.get(menuselect.item as usize).ok_or(ShipError::InvalidShip(menuselect.item as usize))?; let ip = u32::from_ne_bytes(ship.ip.octets());