Skip to content

Commit 98de87e

Browse files
committed
fix clippy
1 parent 761663f commit 98de87e

1 file changed

Lines changed: 16 additions & 20 deletions

File tree

crates/rustc_codegen_spirv/src/linker/destructure_composites.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,25 @@ pub fn destructure_composites(function: &mut Function) {
3434
let mut search_id = current_id;
3535
let mut resolved_id = None;
3636

37-
loop {
38-
if let Some(ref_inst) = reference.get(&search_id) {
39-
match ref_inst.class.opcode {
40-
Op::CompositeInsert => {
41-
let insert_index = ref_inst.operands[2].unwrap_literal_bit32();
42-
if insert_index == index {
43-
resolved_id = Some(ref_inst.operands[0].unwrap_id_ref());
44-
break;
45-
}
46-
// if not our index, continue down the insert chain
47-
search_id = ref_inst.operands[1].unwrap_id_ref();
48-
}
49-
Op::CompositeConstruct => {
50-
resolved_id = ref_inst
51-
.operands
52-
.get(index as usize)
53-
.map(|o| o.unwrap_id_ref());
37+
while let Some(ref_inst) = reference.get(&search_id) {
38+
match ref_inst.class.opcode {
39+
Op::CompositeInsert => {
40+
let insert_index = ref_inst.operands[2].unwrap_literal_bit32();
41+
if insert_index == index {
42+
resolved_id = Some(ref_inst.operands[0].unwrap_id_ref());
5443
break;
5544
}
56-
_ => unreachable!(),
45+
// If not our index, continue down the insert chain
46+
search_id = ref_inst.operands[1].unwrap_id_ref();
47+
}
48+
Op::CompositeConstruct => {
49+
resolved_id = ref_inst
50+
.operands
51+
.get(index as usize)
52+
.map(|o| o.unwrap_id_ref());
53+
break;
5754
}
58-
} else {
59-
break;
55+
_ => unreachable!(),
6056
}
6157
}
6258

0 commit comments

Comments
 (0)