From 41a2746804448b4fc1c2b86e220f224a53ef6d69 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 18 Jul 2026 05:38:27 +0400 Subject: [PATCH] fix(build): align stage zero gates with Rust 1.97 --- apps/fparkan-cli/src/main.rs | 2 +- apps/fparkan-vulkan-smoke/src/main.rs | 11 ++---- crates/fparkan-assets/src/lib.rs | 54 +++++++++++++++++---------- deny.toml | 2 - xtask/src/main.rs | 14 ++----- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/apps/fparkan-cli/src/main.rs b/apps/fparkan-cli/src/main.rs index 3e40f41..f2f35e8 100644 --- a/apps/fparkan-cli/src/main.rs +++ b/apps/fparkan-cli/src/main.rs @@ -312,7 +312,7 @@ fn graph_mission(args: &[String]) -> Result<(), String> { fn inspect_archive(args: &[String]) -> Result<(), String> { let path = parse_archive_path(args)?; - let inspection = inspect_archive_file(&path, 0).map_err(|err| err.to_string())?; + let inspection = inspect_archive_file(&path, 0).map_err(|err| err.clone())?; match inspection { ArchiveInspection::Nres { diff --git a/apps/fparkan-vulkan-smoke/src/main.rs b/apps/fparkan-vulkan-smoke/src/main.rs index 05c8f80..bfd650d 100644 --- a/apps/fparkan-vulkan-smoke/src/main.rs +++ b/apps/fparkan-vulkan-smoke/src/main.rs @@ -420,13 +420,10 @@ impl SmokeApp { event_loop.exit(); return; } - let renderer = match self.renderer.take() { - Some(renderer) => renderer, - None => { - self.error = Some("native smoke renderer was not initialized".to_string()); - event_loop.exit(); - return; - } + let Some(renderer) = self.renderer.take() else { + self.error = Some("native smoke renderer was not initialized".to_string()); + event_loop.exit(); + return; }; let final_renderer = match renderer.shutdown() { Ok(report) => RendererSnapshot::from(report), diff --git a/crates/fparkan-assets/src/lib.rs b/crates/fparkan-assets/src/lib.rs index 2202ede..9fb90ed 100644 --- a/crates/fparkan-assets/src/lib.rs +++ b/crates/fparkan-assets/src/lib.rs @@ -664,6 +664,9 @@ pub fn prepare_mission_assets_profiled_with_repository( ) } +// This orchestration intentionally keeps preparation, deduplication, and limit enforcement +// together so all fallible asset construction remains transactional. +#[allow(clippy::too_many_lines)] fn prepare_mission_assets_with_repository_internal( repository: &R, root_prototype_spans: &[std::ops::Range], @@ -692,7 +695,7 @@ fn prepare_mission_assets_with_repository_internal( let mut prototype_visual_ids = Vec::with_capacity(prototypes.len()); for proto in prototypes { - let visual_id = AssetId::new((identity_policy.visual_id)(proto)); + let visual_id = AssetId::new((identity_policy.visual)(proto)); let signature = prepared_visual_signature(proto); match visual_index_by_id.get(&visual_id) { Some(existing) if existing != &signature => { @@ -813,21 +816,21 @@ enum PreparedVisualSignature { #[derive(Clone, Copy)] struct AssetIdentityPolicy { - visual_id: fn(&EffectivePrototype) -> u64, - model_id: fn(&EffectivePrototype) -> u64, - wear_id: fn(&EffectivePrototype) -> u64, - material_id: fn(&EffectivePrototype, u16, &ResourceName) -> u64, - texture_id: fn(&ResourceKey, PreparedTextureUsage) -> u64, + visual: fn(&EffectivePrototype) -> u64, + model: fn(&EffectivePrototype) -> u64, + wear: fn(&EffectivePrototype) -> u64, + material: fn(&EffectivePrototype, u16, &ResourceName) -> u64, + texture: fn(&ResourceKey, PreparedTextureUsage) -> u64, } impl Default for AssetIdentityPolicy { fn default() -> Self { Self { - visual_id: stable_visual_id, - model_id: stable_model_id, - wear_id: stable_wear_id, - material_id: stable_material_id, - texture_id: stable_texture_id, + visual: stable_visual_id, + model: stable_model_id, + wear: stable_wear_id, + material: stable_material_id, + texture: stable_texture_id, } } } @@ -1011,6 +1014,14 @@ fn enforce_asset_preparation_limits( /// /// This function validates WEAR/material/TEXM/LIGHTMAP resolution for each resolved /// prototype without constructing full immutable assets. +/// +/// # Panics +/// +/// Panics only if the hard-coded, host-compatible `material.lib` path stops satisfying +/// the path policy, which indicates a programming error in this module. +// The graph expansion is deliberately a single transactional traversal so every generated +// edge receives the correct parent provenance and node/edge sequence. +#[allow(clippy::too_many_lines)] pub fn extend_graph_report_with_visual_dependencies( repository: &R, report: &mut PrototypeGraphReport, @@ -1020,6 +1031,7 @@ pub fn extend_graph_report_with_visual_dependencies( if graph.visual_dependencies_expanded { return; } + #[allow(clippy::expect_used)] let material_archive = parse_path("material.lib") .expect("static material archive path must satisfy host-compatible normalization"); let mut next_node = graph @@ -1382,6 +1394,8 @@ struct PreparedVisualBundle { textures: Vec, } +// Keeps the complete model -> WEAR -> material -> texture transaction in one fallible boundary. +#[allow(clippy::too_many_lines)] fn prepare_visual_with_repository_internal( repository: &R, proto: &EffectivePrototype, @@ -1404,7 +1418,7 @@ fn prepare_visual_with_repository_internal( .map_err(AssetError::Nres)?; let msh_document = decode_msh(&nres).map_err(AssetError::Msh)?; let model = validate_msh(&msh_document).map_err(AssetError::Msh)?; - let model_id = AssetId::new((identity_policy.model_id)(proto)); + let model_id = AssetId::new((identity_policy.model)(proto)); let prepared_model = PreparedModel { id: model_id, source: mesh_key.clone(), @@ -1420,7 +1434,7 @@ fn prepare_visual_with_repository_internal( }; let wear = decode_wear(&read_key(repository, &wear_key, Some("wear"))?) .map_err(AssetError::Material)?; - let wear_id = AssetId::new((identity_policy.wear_id)(proto)); + let wear_id = AssetId::new((identity_policy.wear)(proto)); let prepared_wear = PreparedWear { id: wear_id, source: wear_key.clone(), @@ -1447,7 +1461,7 @@ fn prepare_visual_with_repository_internal( let material = resolve_material(repository, &wear, material_index).map_err(AssetError::Material)?; material_count += 1; - let material_id = AssetId::new((identity_policy.material_id)( + let material_id = AssetId::new((identity_policy.material)( proto, material_index, &material.name, @@ -1495,7 +1509,7 @@ fn prepare_visual_with_repository_internal( Ok(PreparedVisualBundle { visual: PreparedVisual { - id: AssetId::new((identity_policy.visual_id)(proto)), + id: AssetId::new((identity_policy.visual)(proto)), mesh: Some(mesh_key.clone()), model_id: Some(model_id), wear_id: Some(wear_id), @@ -1764,7 +1778,7 @@ fn prepare_texture( }; let texm = decode_texm(bytes).map_err(AssetError::Texture)?; Ok(PreparedTexture { - id: AssetId::new((identity_policy.texture_id)(&key, usage)), + id: AssetId::new((identity_policy.texture)(&key, usage)), source: key, texm, usage, @@ -2415,7 +2429,7 @@ mod tests { fn forced_model_id_collision_is_rejected() { assert_forced_collision( AssetIdentityPolicy { - model_id: |_| 7, + model: |_| 7, ..AssetIdentityPolicy::default() }, "stable model id collision", @@ -2426,7 +2440,7 @@ mod tests { fn forced_wear_id_collision_is_rejected() { assert_forced_collision( AssetIdentityPolicy { - wear_id: |_| 11, + wear: |_| 11, ..AssetIdentityPolicy::default() }, "stable wear id collision", @@ -2437,7 +2451,7 @@ mod tests { fn forced_material_id_collision_is_rejected() { assert_forced_collision( AssetIdentityPolicy { - material_id: |_, _, _| 13, + material: |_, _, _| 13, ..AssetIdentityPolicy::default() }, "stable material id collision", @@ -2448,7 +2462,7 @@ mod tests { fn forced_texture_id_collision_is_rejected() { assert_forced_collision( AssetIdentityPolicy { - texture_id: |_, _| 17, + texture: |_, _| 17, ..AssetIdentityPolicy::default() }, "stable texture id collision", diff --git a/deny.toml b/deny.toml index 7717806..7dd2949 100644 --- a/deny.toml +++ b/deny.toml @@ -14,8 +14,6 @@ deny = [ ] [licenses] -unlicensed = "deny" -copyleft = "allow" allow = [ "Apache-2.0", "BSD-2-Clause", diff --git a/xtask/src/main.rs b/xtask/src/main.rs index fbee066..0e6864c 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -543,15 +543,7 @@ fn run_cargo_deny() -> Result<(), String> { } let status = Command::new(cargo_deny) - .args([ - "check", - "--workspace", - "--all-features", - "advisories", - "bans", - "licenses", - "sources", - ]) + .args(["check", "advisories", "bans", "licenses", "sources"]) .status() .map_err(|err| format!("failed to run cargo-deny: {err}"))?; if status.success() { @@ -1886,7 +1878,7 @@ fn parse_native_smoke_audit_options(args: &[String]) -> Result { let value = iter.next().ok_or_else(|| { @@ -1895,7 +1887,7 @@ fn parse_native_smoke_audit_options(args: &[String]) -> Result return Err(format!("unknown native-smoke audit option: {arg}")), }