From 9819f87fcc831797840df9819df076058c2dceb0 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 15 Sep 2022 16:26:31 -0400 Subject: [PATCH] Suppress some warnings --- src/common.rs | 2 +- src/dat.rs | 3 ++- src/equipment.rs | 2 +- src/exd.rs | 7 +++++-- src/exh.rs | 3 +++ src/log.rs | 3 +++ src/macros.rs | 2 +- src/model.rs | 9 +++++++++ src/mtrl.rs | 8 ++++++++ src/patch.rs | 7 ++++--- src/race.rs | 6 +++--- src/repository.rs | 4 ++-- src/skeleton.rs | 4 ++++ src/tex.rs | 2 ++ 14 files changed, 48 insertions(+), 14 deletions(-) diff --git a/src/common.rs b/src/common.rs index 1ad8279..cc04f6d 100755 --- a/src/common.rs +++ b/src/common.rs @@ -39,7 +39,7 @@ pub fn get_language_code(lang: &Language) -> &'static str { #[binrw] #[brw(repr = i16)] -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Region { Global = -1, // TODO: find patch codes for other regions :-) } diff --git a/src/dat.rs b/src/dat.rs index cb04281..ec98e15 100755 --- a/src/dat.rs +++ b/src/dat.rs @@ -9,7 +9,7 @@ use std::io::{Cursor, Read, Seek, SeekFrom}; #[binrw] #[brw(repr = i32)] -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// The file type of the data entry. pub enum FileType { /// Empty entry, usually invalid. @@ -29,6 +29,7 @@ struct StandardFileBlock { } #[derive(BinRead, Debug)] +#[allow(dead_code)] struct TextureLodBlock { compressed_offset: u32, compressed_size: u32, diff --git a/src/equipment.rs b/src/equipment.rs index 04ce277..1f34d09 100755 --- a/src/equipment.rs +++ b/src/equipment.rs @@ -1,7 +1,7 @@ use crate::race::{get_race_id, Gender, Race, Subrace}; #[repr(u8)] -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] /// The slot the item is for. pub enum Slot { /// The head slot. Shorthand is "met". diff --git a/src/exd.rs b/src/exd.rs index 4f7f631..8e8afe5 100644 --- a/src/exd.rs +++ b/src/exd.rs @@ -8,6 +8,7 @@ use std::io::{Cursor, Seek, SeekFrom}; #[binread] #[br(magic = b"EXDF")] #[br(big)] +#[allow(dead_code)] struct EXDHeader { version: u16, @@ -25,6 +26,7 @@ struct ExcelDataOffset { #[binread] #[br(big)] +#[allow(dead_code)] struct ExcelDataRowHeader { data_size: u32, row_count: u16, @@ -32,6 +34,7 @@ struct ExcelDataRowHeader { #[binread] #[br(big)] +#[allow(dead_code)] pub struct EXD { header: EXDHeader, @@ -198,13 +201,13 @@ impl EXD { ) -> String { use crate::common::get_language_code; - return match language { + match language { Language::None => { format!("{name}_{}.exd", page.start_id) } lang => { format!("{name}_{}_{}.exd", page.start_id, get_language_code(&lang)) } - }; + } } } diff --git a/src/exh.rs b/src/exh.rs index 98f83a5..edb178b 100644 --- a/src/exh.rs +++ b/src/exh.rs @@ -7,6 +7,7 @@ use std::io::Cursor; #[binread] #[br(magic = b"EXHF")] #[br(big)] +#[allow(dead_code)] pub struct EXHHeader { version: u16, @@ -54,6 +55,7 @@ pub struct ExcelColumnDefinition { #[binread] #[br(big)] +#[allow(dead_code)] pub struct ExcelDataPagination { pub start_id: u32, row_count: u32, @@ -61,6 +63,7 @@ pub struct ExcelDataPagination { #[binread] #[br(big)] +#[allow(dead_code)] pub struct EXH { pub header: EXHHeader, diff --git a/src/log.rs b/src/log.rs index 466b314..dc85bf4 100644 --- a/src/log.rs +++ b/src/log.rs @@ -4,6 +4,7 @@ use binrw::BinRead; use std::io::{Cursor, Seek, SeekFrom}; #[binread] +#[allow(dead_code)] pub struct ChatLogHeader { content_size: u32, file_size: u32, @@ -44,6 +45,7 @@ enum EventChannel { #[binread] #[derive(Debug)] +#[allow(dead_code)] pub struct ChatLogEntry { timestamp: u32, filter: EventFilter, @@ -57,6 +59,7 @@ pub struct ChatLogEntry { } #[derive(Debug)] +#[allow(dead_code)] pub struct ChatLog { entries: Vec, } diff --git a/src/macros.rs b/src/macros.rs index 131898f..b333e6c 100755 --- a/src/macros.rs +++ b/src/macros.rs @@ -9,7 +9,7 @@ macro_rules! define_race_enum { } ) => { paste! { - #[derive(PartialEq, Debug)] + #[derive(PartialEq, Eq, Debug)] pub enum $name { $( diff --git a/src/model.rs b/src/model.rs index 8b6abf7..e9a6796 100755 --- a/src/model.rs +++ b/src/model.rs @@ -63,6 +63,7 @@ enum ModelFlags2 { #[binread] #[derive(Debug)] +#[allow(dead_code)] pub struct ModelHeader { #[br(pad_after = 2)] string_count: u16, @@ -107,6 +108,7 @@ pub struct ModelHeader { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct MeshLod { mesh_index: u16, mesh_count: u16, @@ -141,6 +143,7 @@ struct MeshLod { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct Mesh { #[br(pad_after = 2)] vertex_count: u16, @@ -161,6 +164,7 @@ struct Mesh { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct Submesh { index_offset: i32, index_count: i32, @@ -173,6 +177,7 @@ struct Submesh { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct BoneTable { bone_indices: [u16; 64], @@ -182,6 +187,7 @@ struct BoneTable { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct BoundingBox { min: [f32; 4], max: [f32; 4], @@ -189,6 +195,7 @@ struct BoundingBox { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ModelData { header: ModelHeader, @@ -240,6 +247,7 @@ struct ModelData { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ElementId { element_id: u32, parent_bone_name: u32, @@ -276,6 +284,7 @@ enum VertexUsage { #[binread] #[derive(Copy, Clone, Debug)] +#[allow(dead_code)] struct VertexElement { stream: u8, offset: u8, diff --git a/src/mtrl.rs b/src/mtrl.rs index 4b587a8..96b07c6 100644 --- a/src/mtrl.rs +++ b/src/mtrl.rs @@ -4,6 +4,7 @@ use std::io::Cursor; #[binread] #[derive(Debug)] +#[allow(dead_code)] struct MaterialFileHeader { version: u32, file_size: u16, @@ -28,6 +29,7 @@ struct MaterialHeader { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ColorSet { name_offset: u16, #[br(pad_after = 1)] @@ -36,6 +38,7 @@ struct ColorSet { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ColorSetInfo { #[br(count = 256)] data: Vec, @@ -43,6 +46,7 @@ struct ColorSetInfo { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ColorSetDyeInfo { #[br(count = 16)] data: Vec, @@ -50,6 +54,7 @@ struct ColorSetDyeInfo { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct ShaderKey { category: u32, value: u32, @@ -57,6 +62,7 @@ struct ShaderKey { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct Constant { constant_id: u32, value_offset: u16, @@ -65,6 +71,7 @@ struct Constant { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct Sampler { sampler_id: u32, flags: u32, // TODO: unknown @@ -74,6 +81,7 @@ struct Sampler { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct MaterialData { file_header: MaterialFileHeader, diff --git a/src/patch.rs b/src/patch.rs index 8379fff..7723f0a 100755 --- a/src/patch.rs +++ b/src/patch.rs @@ -21,6 +21,7 @@ struct PatchHeader { } #[derive(BinRead, Debug)] +#[allow(dead_code)] struct PatchChunk { #[br(big)] size: u32, @@ -567,7 +568,7 @@ pub(crate) fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchE SqpkOperation::IndexAddDelete(_) => { println!("PATCH: NOP IndexAddDelete"); }, - SqpkOperation::PatchInfo(patch_info) => { + SqpkOperation::PatchInfo(_) => { println!("PATCH: NOP PatchInfo"); } SqpkOperation::TargetInfo(new_target_info) => { @@ -575,10 +576,10 @@ pub(crate) fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchE } } } - ChunkType::FileHeader(header) => { + ChunkType::FileHeader(_) => { println!("PATCH: NOP FileHeader"); } - ChunkType::ApplyOption(option) => { + ChunkType::ApplyOption(_) => { println!("PATCH: NOP ApplyOption"); } ChunkType::AddDirectory(_) => { diff --git a/src/race.rs b/src/race.rs index 2332f3d..5d6d457 100755 --- a/src/race.rs +++ b/src/race.rs @@ -1,4 +1,4 @@ -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] #[repr(u8)] /// Gender of the character. pub enum Gender { @@ -6,7 +6,7 @@ pub enum Gender { Female, } -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] #[repr(u8)] /// The race's "subrace". Each race has two subraces, which are actually identical (even down to the ids!) /// with the exception of Hyurs, which have two unique subraces that are really two separate races. @@ -29,7 +29,7 @@ pub enum Subrace { Veena, } -#[derive(PartialEq)] +#[derive(PartialEq, Eq)] #[repr(u8)] /// The major races of Eorzea. pub enum Race { diff --git a/src/repository.rs b/src/repository.rs index b6831e5..5bb229e 100755 --- a/src/repository.rs +++ b/src/repository.rs @@ -5,7 +5,7 @@ use std::fs; use std::path::{Path, PathBuf}; /// The type of repository, discerning game data from expansion data. -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, Copy, Clone)] #[repr(C)] pub enum RepositoryType { /// The base game directory, like "ffxiv". @@ -65,7 +65,7 @@ fn read_version(p: &Path) -> Option { /// This refers to the specific root directory a file is located in. /// This is a fixed list of directories, and all of them are known. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Category { /// Common files such as game fonts, and other data that doesn't really fit anywhere else. Common, diff --git a/src/skeleton.rs b/src/skeleton.rs index bfe9804..930ca49 100644 --- a/src/skeleton.rs +++ b/src/skeleton.rs @@ -31,6 +31,7 @@ impl Skeleton { #[derive(XmlRead, Debug)] #[xml(tag = "hksection")] + #[allow(dead_code)] struct HkSection { #[xml(attr = "name")] name: String, @@ -41,6 +42,7 @@ impl Skeleton { #[derive(XmlRead, Debug)] #[xml(tag = "hkobject")] + #[allow(dead_code)] struct HkObject { #[xml(attr = "name")] name: Option, @@ -54,6 +56,7 @@ impl Skeleton { #[derive(XmlRead, Debug)] #[xml(tag = "hkparam")] + #[allow(dead_code)] struct HkParam { #[xml(attr = "name")] name: String, @@ -105,6 +108,7 @@ impl Skeleton { #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] + #[allow(dead_code)] struct BoneObject { bone_name: String, bone_number: i32, diff --git a/src/tex.rs b/src/tex.rs index b68fe21..d8a3be9 100644 --- a/src/tex.rs +++ b/src/tex.rs @@ -9,6 +9,7 @@ use texpresso::Format; // Attributes and Format are adapted from Lumina (https://github.com/NotAdam/Lumina/blob/master/src/Lumina/Data/Files/TexFile.cs) bitflags! { #[binread] + #[allow(non_upper_case_globals)] struct TextureAttribute : u32 { const DiscardPerFrame = 0x1; const DiscardPerMap = 0x2; @@ -48,6 +49,7 @@ enum TextureFormat { #[binread] #[derive(Debug)] +#[allow(dead_code)] struct TexHeader { attribute: TextureAttribute, format: TextureFormat,