Skip to content

Commit 96c6506

Browse files
committed
Build & clippy fixes
1 parent dcbb2b7 commit 96c6506

File tree

18 files changed

+66
-48
lines changed

18 files changed

+66
-48
lines changed

lib/src/format/cmdl.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unused)]
2+
13
use std::{io::Cursor, marker::PhantomData};
24

35
use anyhow::{bail, ensure, Result};
@@ -300,21 +302,21 @@ pub struct SMeshLoadInformation {
300302
pub mesh_count: u32,
301303
#[br(count = mesh_count)]
302304
pub meshes: Vec<CRenderMesh>,
303-
#[br(count = (mesh_count + 3) / 4)]
305+
#[br(count = mesh_count.div_ceil(4))]
304306
pub unk_data_1: Vec<u8>,
305-
#[br(count = (mesh_count + 7) / 8)]
307+
#[br(count = mesh_count.div_ceil(8))]
306308
pub unk_data_2: Vec<u8>,
307309
#[bw(try_calc = shorts.len().try_into())]
308310
pub short_count: u32,
309311
#[br(count = short_count)]
310312
pub shorts: Vec<u16>,
311313
// #[bw(try_calc = lod_info.len().try_into())]
312314
pub lod_count: u8,
313-
#[br(count = lod_count)]
315+
#[br(count = lod_count as usize)]
314316
pub lod_info: Vec<SLodInfoOuter>,
315317
#[bw(calc = if lod_rules.is_empty() { 0 } else { 1 })]
316318
pub has_lod_rules: u32,
317-
#[br(if(has_lod_rules == 1), count(lod_count))]
319+
#[br(if(has_lod_rules == 1), count(lod_count as usize))]
318320
pub lod_rules: Vec<SRenderModelLODRule>,
319321
}
320322

lib/src/format/mcon.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const K_CHUNK_MCCD: FourCC = FourCC(*b"MCCD");
2020

2121
#[binrw]
2222
#[derive(Clone, Debug)]
23+
#[allow(unused)]
2324
struct SModConHeader {
2425
unk: u32,
2526
}

lib/src/format/pack.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,10 @@ where O: ByteOrderExt + 'static
444444
ensure!(asset_entry.asset_type == form.id);
445445
ensure!(asset_entry.version.get() == form.reader_version.get());
446446
ensure!(asset_entry.other_version.get() == form.writer_version.get());
447-
ensure!(form.size.get() == 0 || asset_entry.decompressed_size.get() == form.size.get() + 32 /* RFRM */);
447+
ensure!(
448+
form.size.get() == 0
449+
|| asset_entry.decompressed_size.get() == form.size.get() + 32 /* RFRM */
450+
);
448451
}
449452

450453
let asset_id = asset_entry.asset_id.get();

lib/src/format/room.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ fn parse_property_list<R: Read + Seek>(
605605
),
606606
None => (None, None),
607607
};
608-
let value = value.unwrap_or_else(|| ConstructedPropertyValue::Unknown(data));
608+
let value = value.unwrap_or(ConstructedPropertyValue::Unknown(data));
609609
properties.push(ConstructedProperty { id, name, value });
610610
}
611611
Ok(ConstructedPropertyValue::PropertyList(Box::new(ConstructedPropertyList {

lib/src/format/txtr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,8 @@ pub fn decompress_image(
764764
| ETextureFormat::RgbaAstc12x10Srgb
765765
| ETextureFormat::RgbaAstc12x12Srgb => {
766766
let (bw, bh, _) = format.block_size();
767-
let rw = (w + (bw as u32 - 1)) / bw as u32;
768-
let rh = (h + (bh as u32 - 1)) / bh as u32;
767+
let rw = w.div_ceil(bw as u32);
768+
let rh = h.div_ceil(bh as u32);
769769
ensure!(data.len() == rw as usize * rh as usize * 16);
770770
let mut image = RgbaImage::new(w, h);
771771
astc_decode::astc_decode(

lib/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
#![allow(clippy::double_parens)]
12
pub mod format;
23
pub mod util;

lib/src/util/lzss.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a> DecompressionState<'a> {
9494

9595
#[inline]
9696
fn read_byte(&mut self) -> Option<u8> {
97-
if self.input.len() > 0 {
97+
if !self.input.is_empty() {
9898
let b = self.input[0];
9999
self.input = &self.input[1..];
100100
Some(b)

retrotool-gui/src/loaders/lightprobe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ use crate::{
1818
#[derive(Debug, Clone, bevy::reflect::TypeUuid)]
1919
#[uuid = "f5d65a8b-ffcc-47ea-8c9d-1ab30cca723c"]
2020
pub struct LightProbeAsset {
21+
#[allow(unused)]
2122
pub head: LightProbeBundleHeader,
2223
pub textures: Vec<TextureAsset>,
24+
#[allow(unused)]
2325
pub extra: Vec<LightProbeExtra>,
2426
}
2527

retrotool-gui/src/loaders/material.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use zerocopy::LittleEndian;
99
#[derive(Debug, Clone, bevy::reflect::TypeUuid)]
1010
#[uuid = "83269869-1209-408e-8835-bc6f2496e82a"]
1111
pub struct MaterialAsset {
12+
#[allow(unused)]
1213
pub inner: ModelData<LittleEndian>,
1314
}
1415

retrotool-gui/src/loaders/package.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,13 @@ impl AssetIo for RetroAssetIo {
5858
let Some(package_path) = package_path else {
5959
return Err(AssetIoError::NotFound(path.to_owned()));
6060
};
61-
read_asset(&package_path, id).map_err(|e| {
62-
AssetIoError::Io(std::io::Error::new(std::io::ErrorKind::Other, e))
63-
})
61+
read_asset(&package_path, id)
62+
.map_err(|e| AssetIoError::Io(std::io::Error::other(e)))
6463
})
6564
} else if path.extension() == Some("pak".as_ref()) {
6665
// Load pak header only
6766
Box::pin(async move {
68-
read_pak_header(path).map_err(|e| {
69-
AssetIoError::Io(std::io::Error::new(std::io::ErrorKind::Other, e))
70-
})
67+
read_pak_header(path).map_err(|e| AssetIoError::Io(std::io::Error::other(e)))
7168
})
7269
} else {
7370
self.default.load_path(path)

0 commit comments

Comments
 (0)