fix(clippy): address Rust 1.97 lints
Docs Deploy / Build and Deploy MkDocs (push) Successful in 38s
Test / Lint (push) Failing after 2m19s
Test / Test (push) Skipped
Test / Render parity (push) Skipped

This commit is contained in:
2026-07-18 05:31:39 +04:00
parent 2da28d0495
commit fbe5a8497a
8 changed files with 31 additions and 25 deletions
-1
View File
@@ -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,
+8
View File
@@ -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,
+1 -1
View File
@@ -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)
));
}
+12 -8
View File
@@ -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;
+2 -2
View File
@@ -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> {
+1 -1
View File
@@ -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(