Skip to content

Commit 2e393a3

Browse files
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)
1 parent a55d097 commit 2e393a3

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

naga/src/back/spv/layout.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ impl Instruction {
137137
assert_eq!(wc, words.len() as u16);
138138
assert_eq!(op, self.op as u16);
139139

140-
if self.type_id.is_some() {
141-
assert_eq!(words[inst_index], self.type_id.unwrap());
140+
if let Some(type_id) = self.type_id {
141+
assert_eq!(words[inst_index], type_id);
142142
inst_index += 1;
143143
}
144144

145-
if self.result_id.is_some() {
146-
assert_eq!(words[inst_index], self.result_id.unwrap());
145+
if let Some(result_id) = self.result_id {
146+
assert_eq!(words[inst_index], result_id);
147147
inst_index += 1;
148148
}
149149

naga/src/back/wgsl/writer.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,9 @@ impl<W: Write> Writer<W> {
225225
Attribute::MeshStage(mesh_output_name),
226226
Attribute::WorkGroupSize(ep.workgroup_size),
227227
];
228-
if ep.task_payload.is_some() {
229-
let payload_name = module.global_variables[ep.task_payload.unwrap()]
230-
.name
231-
.clone()
232-
.unwrap();
228+
if let Some(task_payload) = ep.task_payload {
229+
let payload_name =
230+
module.global_variables[task_payload].name.clone().unwrap();
233231
mesh_attrs.push(Attribute::TaskPayload(payload_name));
234232
}
235233
mesh_attrs

0 commit comments

Comments
 (0)