From 226afcb0807157883c27ded8e430c55f470f3bb4 Mon Sep 17 00:00:00 2001 From: Andy Newjack Date: Sat, 2 May 2020 22:05:43 -0300 Subject: [PATCH] hella warnings cleanup pt 1. remove unused imports, allow deadcode and unused results --- src/item/armor.rs | 5 ----- src/item/mod.rs | 5 +++-- src/item/shield.rs | 5 ----- src/item/weapon.rs | 4 ---- src/packet/login.rs | 2 +- src/packet/messages.rs | 7 ++++--- 6 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/item/armor.rs b/src/item/armor.rs index cf367fe..08f8759 100644 --- a/src/item/armor.rs +++ b/src/item/armor.rs @@ -1,8 +1,3 @@ -use std::convert::{TryFrom, Into}; -use std::io::{Read, Seek}; -use crate::{PSOPacketData, PacketParseError}; - - #[derive(Debug, Copy, Clone, PartialEq)] pub enum ArmorType { Frame, diff --git a/src/item/mod.rs b/src/item/mod.rs index cc47ed2..c78bac6 100644 --- a/src/item/mod.rs +++ b/src/item/mod.rs @@ -1,10 +1,11 @@ +#![allow(dead_code)] pub mod weapon; pub mod tool; pub mod armor; pub mod shield; use std::io::{Read, Seek}; -use crate::{PSOPacketData, PacketParseError}; +use crate::{PacketParseError}; @@ -20,7 +21,7 @@ pub enum Item { impl Item { - fn from_bytes(cursor: &mut R) -> Result { + fn from_bytes(_cursor: &mut R) -> Result { unimplemented!() } pub fn as_bytes(&self) -> [u8; 16] { diff --git a/src/item/shield.rs b/src/item/shield.rs index 08e1002..bde7f25 100644 --- a/src/item/shield.rs +++ b/src/item/shield.rs @@ -1,8 +1,3 @@ -use std::convert::{TryFrom, Into}; -use std::io::{Read, Seek}; -use crate::{PSOPacketData, PacketParseError}; - - #[derive(Debug, Copy, Clone, PartialEq)] pub enum ShieldType { Barrier, diff --git a/src/item/weapon.rs b/src/item/weapon.rs index 2ee651a..3e0f471 100644 --- a/src/item/weapon.rs +++ b/src/item/weapon.rs @@ -1,9 +1,5 @@ use std::convert::{TryFrom, Into}; -use std::io::{Read, Seek}; -use crate::{PSOPacketData, PacketParseError}; - - #[derive(Debug, Copy, Clone, PartialEq)] pub enum Attribute { Native, diff --git a/src/packet/login.rs b/src/packet/login.rs index af7784e..233f05f 100644 --- a/src/packet/login.rs +++ b/src/packet/login.rs @@ -546,7 +546,7 @@ mod tests { #[test] fn test_key_settings_reply() { use super::PSOPacket; - use rand::{Rng, RngCore}; + use rand::{Rng}; let mut rng = rand::thread_rng(); diff --git a/src/packet/messages.rs b/src/packet/messages.rs index abe9138..8d36512 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -1,4 +1,5 @@ -use std::io::{Seek, SeekFrom}; +#![allow(unused_must_use)] +use std::io::{SeekFrom}; use psopacket::pso_message; use crate::{PSOPacketData, PacketParseError}; @@ -757,7 +758,7 @@ pub struct DropCoordinates { drop_area: u32, x: f32, z: f32, - drop_ID: u32, + drop_id: u32, } #[pso_message(0xC4)] @@ -1062,7 +1063,7 @@ impl PSOPacketData for GameMessage { cur.seek(SeekFrom::Current(-2)); // Cursor doesn't implement Peek? match byte[0] { PlayerActivatedSwitch::CMD => Ok(GameMessage::PlayerActivatedSwitch(PlayerActivatedSwitch::from_bytes(&mut cur)?)), - GuildcardSend::CMD => Ok(GameMessage::GuildcardSend(GuildcardSend::from_bytes(&mut cur)?)), + GuildcardSend::CMD if len[0] == 1 => Ok(GameMessage::GuildcardSend(GuildcardSend::from_bytes(&mut cur)?)), GuildcardRecv::CMD => Ok(GameMessage::GuildcardRecv(GuildcardRecv::from_bytes(&mut cur)?)), SymbolChat::CMD => Ok(GameMessage::SymbolChat(SymbolChat::from_bytes(&mut cur)?)), MobAttack::CMD => Ok(GameMessage::MobAttack(MobAttack::from_bytes(&mut cur)?)),