aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-07-18 04:31:39 +0300
committerValentin Popov <valentin@popov.link>2026-07-18 04:31:39 +0300
commitfbe5a8497a9d8b9b7093182f51c506825d6e34cf (patch)
treed14a6442ada46707eebf1948eea8d0337fe8edc8 /crates
parent2da28d0495e75a0954c194e2e0c4db03c23cb05f (diff)
downloadfparkan-fbe5a8497a9d8b9b7093182f51c506825d6e34cf.tar.xz
fparkan-fbe5a8497a9d8b9b7093182f51c506825d6e34cf.zip
fix(clippy): address Rust 1.97 lints
Diffstat (limited to 'crates')
-rw-r--r--crates/fparkan-animation/src/lib.rs1
-rw-r--r--crates/fparkan-inspection/src/lib.rs8
-rw-r--r--crates/fparkan-nres/src/lib.rs2
-rw-r--r--crates/fparkan-resource/src/lib.rs20
-rw-r--r--crates/fparkan-vfs/src/lib.rs4
-rw-r--r--crates/fparkan-world/src/lib.rs2
6 files changed, 24 insertions, 13 deletions
diff --git a/crates/fparkan-animation/src/lib.rs b/crates/fparkan-animation/src/lib.rs
index 7903f88..36db0e7 100644
--- a/crates/fparkan-animation/src/lib.rs
+++ b/crates/fparkan-animation/src/lib.rs
@@ -4,7 +4,6 @@
allow(
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
- clippy::cast_precision_loss,
clippy::expect_used,
clippy::float_cmp,
clippy::identity_op,
diff --git a/crates/fparkan-inspection/src/lib.rs b/crates/fparkan-inspection/src/lib.rs
index f4a085d..983505a 100644
--- a/crates/fparkan-inspection/src/lib.rs
+++ b/crates/fparkan-inspection/src/lib.rs
@@ -146,6 +146,8 @@ pub fn inspect_archive_file(path: &Path, sample_limit: usize) -> Result<ArchiveI
/// # Errors
///
/// Returns a [`Diagnostic`] when the archive cannot be read or decoded.
+// Diagnostic is deliberately returned by value as the public structured-error contract.
+#[allow(clippy::result_large_err)]
pub fn inspect_archive_file_diagnostic(
path: &Path,
sample_limit: usize,
@@ -206,6 +208,8 @@ pub fn inspect_archive_file_diagnostic(
}
/// Inspects archive bytes and returns a typed summary.
+// Keeps the internal diagnostic flow aligned with the public structured-error contract.
+#[allow(clippy::result_large_err)]
fn inspect_archive_bytes(
bytes: &[u8],
sample_limit: usize,
@@ -371,6 +375,8 @@ fn inspect_land_map(document: &NresDocument) -> Result<MapInspection, String> {
})
}
+// Preserves the shared structured-error type without changing callers to boxed errors.
+#[allow(clippy::result_large_err)]
fn read_resource_bytes_diagnostic(
root: &Path,
archive: &str,
@@ -438,6 +444,8 @@ fn read_resource_bytes_diagnostic(
Ok(Arc::from(bytes.into_owned()))
}
+// Preserves the shared structured-error type without changing callers to boxed errors.
+#[allow(clippy::result_large_err)]
fn load_model_document_from_root_diagnostic(
root: &Path,
archive: &str,
diff --git a/crates/fparkan-nres/src/lib.rs b/crates/fparkan-nres/src/lib.rs
index 86dd613..778b76b 100644
--- a/crates/fparkan-nres/src/lib.rs
+++ b/crates/fparkan-nres/src/lib.rs
@@ -1270,7 +1270,7 @@ mod tests {
Err(NresError::Binary(DecodeError::LimitExceeded {
count,
limit
- })) if count == i32::MAX as u64 && limit == DecodeLimits::default().max_entries as u64
+ })) if count == i32::MAX as u64 && limit == u64::from(DecodeLimits::default().max_entries)
));
}
diff --git a/crates/fparkan-resource/src/lib.rs b/crates/fparkan-resource/src/lib.rs
index e60b3ba..9697e8b 100644
--- a/crates/fparkan-resource/src/lib.rs
+++ b/crates/fparkan-resource/src/lib.rs
@@ -412,17 +412,21 @@ impl CachedResourceRepository {
/// Creates a cached repository with a decoded payload entry budget.
#[must_use]
pub fn with_payload_cache_budget(vfs: Arc<dyn Vfs>, max_payload_entries: usize) -> Self {
- let mut limits = RepositoryLimits::default();
- limits.max_decoded_payload_entries = max_payload_entries;
+ let limits = RepositoryLimits {
+ max_decoded_payload_entries: max_payload_entries,
+ ..RepositoryLimits::default()
+ };
Self::with_limits(vfs, limits)
}
/// Creates a cached repository with decoded payload entry and byte budgets.
#[must_use]
pub fn with_payload_cache_limits(vfs: Arc<dyn Vfs>, limits: PayloadCacheLimits) -> Self {
- let mut repository_limits = RepositoryLimits::default();
- repository_limits.max_decoded_payload_entries = limits.max_entries;
- repository_limits.max_decoded_payload_bytes = limits.max_bytes;
+ let repository_limits = RepositoryLimits {
+ max_decoded_payload_entries: limits.max_entries,
+ max_decoded_payload_bytes: limits.max_bytes,
+ ..RepositoryLimits::default()
+ };
Self::with_limits(vfs, repository_limits)
}
@@ -482,11 +486,11 @@ impl ResourceRepository for CachedResourceRepository {
}
let current_generation = current.generation;
let current_fingerprint = current.fingerprint;
- if current_fingerprint != observed_fingerprint {
+ if current_fingerprint == observed_fingerprint {
+ slot.generation = current_generation;
+ } else {
slot.generation = current_generation.saturating_add(1);
state.payload_cache.remove_archive(id);
- } else {
- slot.generation = current_generation;
}
state.unload_archive(id)?;
*state.archive_mut(id)? = slot;
diff --git a/crates/fparkan-vfs/src/lib.rs b/crates/fparkan-vfs/src/lib.rs
index 4557884..0b25056 100644
--- a/crates/fparkan-vfs/src/lib.rs
+++ b/crates/fparkan-vfs/src/lib.rs
@@ -122,7 +122,7 @@ impl DirectoryVfs {
resolve_casefolded(&self.root, path)
}
- fn metadata_from_host_file(&self, path: &Path) -> Result<VfsMetadata, VfsError> {
+ fn metadata_from_host_file(path: &Path) -> Result<VfsMetadata, VfsError> {
let metadata = fs::symlink_metadata(path).map_err(VfsError::Io)?;
metadata_from_host_file(path, &metadata)
}
@@ -130,7 +130,7 @@ impl DirectoryVfs {
impl Vfs for DirectoryVfs {
fn metadata(&self, path: &NormalizedPath) -> Result<VfsMetadata, VfsError> {
- self.metadata_from_host_file(&self.host_path(path)?)
+ Self::metadata_from_host_file(&self.host_path(path)?)
}
fn read(&self, path: &NormalizedPath) -> Result<Arc<[u8]>, VfsError> {
diff --git a/crates/fparkan-world/src/lib.rs b/crates/fparkan-world/src/lib.rs
index 5d659b9..62108fe 100644
--- a/crates/fparkan-world/src/lib.rs
+++ b/crates/fparkan-world/src/lib.rs
@@ -1053,7 +1053,7 @@ mod tests {
handles.push(handle);
}
for (index, handle) in handles.iter().copied().enumerate() {
- if (seed as usize + index) % 3 == 0 {
+ if (seed as usize + index).is_multiple_of(3) {
request_delete(&mut world, handle).expect("delete");
} else {
enqueue(