From ec04c13fbd00e1bd8ba127e4cdcc21085e4c4f3b Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 29 Jun 2024 09:33:23 -0400 Subject: [PATCH] Silence more dead code warnings This is intentional, for various reasons between binrw limitations and code that isn't used directly in Physis. --- src/avfx.rs | 1 + src/dat.rs | 1 + src/existing_dirs.rs | 5 ++++- src/havok/animation.rs | 2 ++ src/havok/animation_binding.rs | 2 ++ src/havok/animation_container.rs | 2 ++ src/havok/object.rs | 1 + src/havok/slice_ext.rs | 2 ++ src/index.rs | 1 + src/pbd.rs | 3 +++ src/phyb.rs | 1 + src/schd.rs | 1 + src/sha1.rs | 1 + src/shpk.rs | 2 +- src/stm.rs | 1 + tests/integration_test.rs | 7 +------ 16 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/avfx.rs b/src/avfx.rs index 1602763..890f6c2 100644 --- a/src/avfx.rs +++ b/src/avfx.rs @@ -175,6 +175,7 @@ struct AvfxBlock { } #[derive(Debug)] +#[allow(dead_code)] pub struct Avfx { clip_box: [f32; 3], clip_box_size: [f32; 3], diff --git a/src/dat.rs b/src/dat.rs index 913cb71..c0acb34 100755 --- a/src/dat.rs +++ b/src/dat.rs @@ -89,6 +89,7 @@ impl AnyNumberType<'a>> ModelMemorySizes { } #[derive(BinRead)] +#[allow(dead_code)] pub struct ModelFileBlock { pub num_blocks: u32, pub num_used_blocks: u32, diff --git a/src/existing_dirs.rs b/src/existing_dirs.rs index f3625f9..0ee585f 100644 --- a/src/existing_dirs.rs +++ b/src/existing_dirs.rs @@ -1,7 +1,10 @@ // SPDX-FileCopyrightText: 2024 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later +// Rust deprecating this is stupid, I don't want to use a crate here +#[allow(deprecated)] use std::env::home_dir; + use std::fs; use std::fs::read_dir; use std::path::PathBuf; @@ -110,7 +113,7 @@ pub struct ExistingUserDirectory { /// Finds existing user folders on disk. Will only return locations that actually have files in them, and a really basic check to see if the data is valid. pub fn find_existing_user_dirs() -> Vec { let mut user_dirs = Vec::new(); - let Some(home_dir) = home_dir() else { + let Some(_) = home_dir() else { return user_dirs; }; diff --git a/src/havok/animation.rs b/src/havok/animation.rs index 20e2886..249fdd0 100644 --- a/src/havok/animation.rs +++ b/src/havok/animation.rs @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2020 Inseok Lee // SPDX-License-Identifier: MIT +#![allow(dead_code)] + use crate::havok::transform::HavokTransform; pub trait HavokAnimation { diff --git a/src/havok/animation_binding.rs b/src/havok/animation_binding.rs index 392f751..1f8aff6 100644 --- a/src/havok/animation_binding.rs +++ b/src/havok/animation_binding.rs @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2020 Inseok Lee // SPDX-License-Identifier: MIT +#![allow(dead_code)] + use crate::havok::object::HavokObject; use crate::havok::spline_compressed_animation::HavokSplineCompressedAnimation; use crate::havok::HavokAnimation; diff --git a/src/havok/animation_container.rs b/src/havok/animation_container.rs index 018dd2b..9ba37b6 100644 --- a/src/havok/animation_container.rs +++ b/src/havok/animation_container.rs @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2020 Inseok Lee // SPDX-License-Identifier: MIT +#![allow(dead_code)] + use crate::havok::animation_binding::HavokAnimationBinding; use crate::havok::object::HavokObject; use crate::havok::skeleton::HavokSkeleton; diff --git a/src/havok/object.rs b/src/havok/object.rs index 39268d0..892e138 100644 --- a/src/havok/object.rs +++ b/src/havok/object.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: MIT #![allow(clippy::bad_bit_mask)] +#![allow(dead_code)] use core::cell::RefCell; use std::collections::HashMap; diff --git a/src/havok/slice_ext.rs b/src/havok/slice_ext.rs index e1b663c..1c017c6 100644 --- a/src/havok/slice_ext.rs +++ b/src/havok/slice_ext.rs @@ -1,6 +1,8 @@ // SPDX-FileCopyrightText: 2020 Inseok Lee // SPDX-License-Identifier: MIT +#![allow(dead_code)] + use core::convert::TryInto; pub trait SliceByteOrderExt { diff --git a/src/index.rs b/src/index.rs index 71c4077..bbd2337 100755 --- a/src/index.rs +++ b/src/index.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-3.0-or-later #![allow(clippy::identity_op)] +#![allow(unused_variables)] // for br(temp), meh use std::io::SeekFrom; diff --git a/src/pbd.rs b/src/pbd.rs index 90aae23..c181a12 100644 --- a/src/pbd.rs +++ b/src/pbd.rs @@ -12,6 +12,7 @@ use binrw::BinRead; #[derive(Debug)] #[br(import { data_offset: i32 })] #[brw(little)] +#[allow(unused)] struct RacialDeformer { bone_count: i32, @@ -51,6 +52,7 @@ struct PreBoneDeformerItem { #[binread] #[derive(Debug)] #[brw(little)] +#[allow(dead_code)] struct PreBoneDeformerLink { parent_index: i16, first_child_index: i16, @@ -61,6 +63,7 @@ struct PreBoneDeformerLink { #[binread] #[derive(Debug)] #[brw(little)] +#[allow(dead_code)] struct PreBoneDeformerHeader { count: i32, diff --git a/src/phyb.rs b/src/phyb.rs index 2d32b66..96c8986 100644 --- a/src/phyb.rs +++ b/src/phyb.rs @@ -10,6 +10,7 @@ use binrw::BinRead; #[binread] #[derive(Debug)] #[brw(little)] +#[allow(dead_code)] struct PhybHeader { version: [u8; 4], diff --git a/src/schd.rs b/src/schd.rs index d03b110..49b3caf 100644 --- a/src/schd.rs +++ b/src/schd.rs @@ -20,6 +20,7 @@ pub enum ShaderStage { #[binread] #[derive(Debug)] #[brw(little)] +#[allow(dead_code)] struct SchdHeader { magic: i32, // TODO: what magic? diff --git a/src/sha1.rs b/src/sha1.rs index de339b1..7377f79 100644 --- a/src/sha1.rs +++ b/src/sha1.rs @@ -13,6 +13,7 @@ #![allow(deprecated)] #![allow(clippy::double_parens)] #![allow(clippy::identity_op)] +#![allow(dead_code)] use core::cmp; use core::fmt; diff --git a/src/shpk.rs b/src/shpk.rs index 0368153..4dc12f2 100644 --- a/src/shpk.rs +++ b/src/shpk.rs @@ -129,7 +129,7 @@ pub struct Node { #[br(little)] #[br(magic = b"ShPk")] #[derive(Debug)] -#[allow(dead_code)] +#[allow(dead_code, unused_variables)] pub struct ShaderPackage { version: u32, diff --git a/src/stm.rs b/src/stm.rs index c901d24..d3cc126 100644 --- a/src/stm.rs +++ b/src/stm.rs @@ -25,6 +25,7 @@ struct StmHeader { } #[derive(Debug)] +#[allow(dead_code)] pub struct DyePack { diffuse: [f32; 3], specular: [f32; 3], diff --git a/tests/integration_test.rs b/tests/integration_test.rs index e790258..85252b8 100755 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -1,17 +1,12 @@ // SPDX-FileCopyrightText: 2023 Joshua Goins // SPDX-License-Identifier: GPL-3.0-or-later -use hmac_sha512::Hash; -use physis::patch::apply_patch; use std::env; -use std::fs::{read, read_dir}; -use std::process::Command; +use std::fs::read; use physis::common::Platform; use physis::fiin::FileInfo; use physis::index; -use std::collections::HashMap; -use std::path::{Path, PathBuf}; #[test] #[cfg_attr(not(feature = "retail_game_testing"), ignore)]