From 59c351be6aec04a34ee5bc618e23bf4102dcb1e3 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 27 Jan 2026 15:34:06 -0500 Subject: [PATCH] refactor: satisfy `clippy::unnecessary_unwrap` New in Rust 1.93! Reference: [`clippy::unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap) --- naga/src/back/spv/layout.rs | 8 ++++---- naga/src/back/wgsl/writer.rs | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/naga/src/back/spv/layout.rs b/naga/src/back/spv/layout.rs index d44e145c3..1bd1f4375 100644 --- a/naga/src/back/spv/layout.rs +++ b/naga/src/back/spv/layout.rs @@ -137,13 +137,13 @@ impl Instruction { assert_eq!(wc, words.len() as u16); assert_eq!(op, self.op as u16); - if self.type_id.is_some() { - assert_eq!(words[inst_index], self.type_id.unwrap()); + if let Some(type_id) = self.type_id { + assert_eq!(words[inst_index], type_id); inst_index += 1; } - if self.result_id.is_some() { - assert_eq!(words[inst_index], self.result_id.unwrap()); + if let Some(result_id) = self.result_id { + assert_eq!(words[inst_index], result_id); inst_index += 1; } diff --git a/naga/src/back/wgsl/writer.rs b/naga/src/back/wgsl/writer.rs index 8f74ed4df..a57ca5a6f 100644 --- a/naga/src/back/wgsl/writer.rs +++ b/naga/src/back/wgsl/writer.rs @@ -225,11 +225,9 @@ impl Writer { Attribute::MeshStage(mesh_output_name), Attribute::WorkGroupSize(ep.workgroup_size), ]; - if ep.task_payload.is_some() { - let payload_name = module.global_variables[ep.task_payload.unwrap()] - .name - .clone() - .unwrap(); + if let Some(task_payload) = ep.task_payload { + let payload_name = + module.global_variables[task_payload].name.clone().unwrap(); mesh_attrs.push(Attribute::TaskPayload(payload_name)); } mesh_attrs