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
@@ -43,7 +43,7 @@ fn take_runtime_children_with_validation_snapshot<
surface: &mut Option<Surface>, surface: &mut Option<Surface>,
device: &mut Option<Device>, device: &mut Option<Device>,
swapchain: &mut Option<Swapchain>, swapchain: &mut Option<Swapchain>,
validation: &Option<Validation>, validation: Option<&Validation>,
capture: Capture, capture: Capture,
) -> Option<Snapshot> ) -> Option<Snapshot>
where where
@@ -52,7 +52,7 @@ where
swapchain.take(); swapchain.take();
device.take(); device.take();
surface.take(); surface.take();
validation.as_ref().map(capture) validation.map(capture)
} }
struct RollbackOnDrop<T, F> struct RollbackOnDrop<T, F>
@@ -672,7 +672,7 @@ impl VulkanSmokeRenderer {
&mut self.surface, &mut self.surface,
&mut self.device, &mut self.device,
&mut self.swapchain, &mut self.swapchain,
&self.validation, self.validation.as_ref(),
VulkanValidationMessenger::report, VulkanValidationMessenger::report,
) )
.unwrap_or_default(); .unwrap_or_default();
@@ -695,7 +695,7 @@ impl VulkanSmokeRenderer {
&mut self.surface, &mut self.surface,
&mut self.device, &mut self.device,
&mut self.swapchain, &mut self.swapchain,
&self.validation, self.validation.as_ref(),
VulkanValidationMessenger::report, VulkanValidationMessenger::report,
); );
self.validation.take(); self.validation.take();
@@ -864,7 +864,7 @@ mod tests {
&mut surface, &mut surface,
&mut device, &mut device,
&mut swapchain, &mut swapchain,
&validation, validation.as_ref(),
|_| { |_| {
log.borrow_mut().push(TeardownStep::Snapshot); log.borrow_mut().push(TeardownStep::Snapshot);
TeardownStep::Validation TeardownStep::Validation
@@ -10,9 +10,10 @@ use crate::{
}; };
/// Vulkan backend migration readiness. /// Vulkan backend migration readiness.
#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum VulkanPlanningBackendState { pub enum VulkanPlanningBackendState {
/// Planning facade is configured and able to accept command lists. /// Planning facade is configured and able to accept command lists.
#[default]
Configured, Configured,
/// Adapter is tracking a recoverable runtime surface/depth pipeline fault. /// Adapter is tracking a recoverable runtime surface/depth pipeline fault.
Degraded, Degraded,
@@ -20,12 +21,6 @@ pub enum VulkanPlanningBackendState {
Error, Error,
} }
impl Default for VulkanPlanningBackendState {
fn default() -> Self {
Self::Configured
}
}
/// Diagnostics for planning-facade request tracking. /// Diagnostics for planning-facade request tracking.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct VulkanPlanningRequestReport { pub struct VulkanPlanningRequestReport {
-1
View File
@@ -4,7 +4,6 @@
allow( allow(
clippy::cast_possible_truncation, clippy::cast_possible_truncation,
clippy::cast_possible_wrap, clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::expect_used, clippy::expect_used,
clippy::float_cmp, clippy::float_cmp,
clippy::identity_op, clippy::identity_op,
+8
View File
@@ -146,6 +146,8 @@ pub fn inspect_archive_file(path: &Path, sample_limit: usize) -> Result<ArchiveI
/// # Errors /// # Errors
/// ///
/// Returns a [`Diagnostic`] when the archive cannot be read or decoded. /// 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( pub fn inspect_archive_file_diagnostic(
path: &Path, path: &Path,
sample_limit: usize, sample_limit: usize,
@@ -206,6 +208,8 @@ pub fn inspect_archive_file_diagnostic(
} }
/// Inspects archive bytes and returns a typed summary. /// 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( fn inspect_archive_bytes(
bytes: &[u8], bytes: &[u8],
sample_limit: usize, 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( fn read_resource_bytes_diagnostic(
root: &Path, root: &Path,
archive: &str, archive: &str,
@@ -438,6 +444,8 @@ fn read_resource_bytes_diagnostic(
Ok(Arc::from(bytes.into_owned())) 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( fn load_model_document_from_root_diagnostic(
root: &Path, root: &Path,
archive: &str, archive: &str,
+1 -1
View File
@@ -1270,7 +1270,7 @@ mod tests {
Err(NresError::Binary(DecodeError::LimitExceeded { Err(NresError::Binary(DecodeError::LimitExceeded {
count, count,
limit 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. /// Creates a cached repository with a decoded payload entry budget.
#[must_use] #[must_use]
pub fn with_payload_cache_budget(vfs: Arc<dyn Vfs>, max_payload_entries: usize) -> Self { pub fn with_payload_cache_budget(vfs: Arc<dyn Vfs>, max_payload_entries: usize) -> Self {
let mut limits = RepositoryLimits::default(); let limits = RepositoryLimits {
limits.max_decoded_payload_entries = max_payload_entries; max_decoded_payload_entries: max_payload_entries,
..RepositoryLimits::default()
};
Self::with_limits(vfs, limits) Self::with_limits(vfs, limits)
} }
/// Creates a cached repository with decoded payload entry and byte budgets. /// Creates a cached repository with decoded payload entry and byte budgets.
#[must_use] #[must_use]
pub fn with_payload_cache_limits(vfs: Arc<dyn Vfs>, limits: PayloadCacheLimits) -> Self { pub fn with_payload_cache_limits(vfs: Arc<dyn Vfs>, limits: PayloadCacheLimits) -> Self {
let mut repository_limits = RepositoryLimits::default(); let repository_limits = RepositoryLimits {
repository_limits.max_decoded_payload_entries = limits.max_entries; max_decoded_payload_entries: limits.max_entries,
repository_limits.max_decoded_payload_bytes = limits.max_bytes; max_decoded_payload_bytes: limits.max_bytes,
..RepositoryLimits::default()
};
Self::with_limits(vfs, repository_limits) Self::with_limits(vfs, repository_limits)
} }
@@ -482,11 +486,11 @@ impl ResourceRepository for CachedResourceRepository {
} }
let current_generation = current.generation; let current_generation = current.generation;
let current_fingerprint = current.fingerprint; 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); slot.generation = current_generation.saturating_add(1);
state.payload_cache.remove_archive(id); state.payload_cache.remove_archive(id);
} else {
slot.generation = current_generation;
} }
state.unload_archive(id)?; state.unload_archive(id)?;
*state.archive_mut(id)? = slot; *state.archive_mut(id)? = slot;
+2 -2
View File
@@ -122,7 +122,7 @@ impl DirectoryVfs {
resolve_casefolded(&self.root, path) 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)?; let metadata = fs::symlink_metadata(path).map_err(VfsError::Io)?;
metadata_from_host_file(path, &metadata) metadata_from_host_file(path, &metadata)
} }
@@ -130,7 +130,7 @@ impl DirectoryVfs {
impl Vfs for DirectoryVfs { impl Vfs for DirectoryVfs {
fn metadata(&self, path: &NormalizedPath) -> Result<VfsMetadata, VfsError> { 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> { fn read(&self, path: &NormalizedPath) -> Result<Arc<[u8]>, VfsError> {
+1 -1
View File
@@ -1053,7 +1053,7 @@ mod tests {
handles.push(handle); handles.push(handle);
} }
for (index, handle) in handles.iter().copied().enumerate() { 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"); request_delete(&mut world, handle).expect("delete");
} else { } else {
enqueue( enqueue(