nak: simplify phi_dsts

clippy complained that nothing was actually looping here. Luckily we can
simplify the code.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27216>
This commit is contained in:
Karol Herbst
2024-01-23 17:02:35 +01:00
committed by Marge Bot
parent 0a414ecdf5
commit 548d919bd3

View File

@@ -5488,22 +5488,16 @@ impl BasicBlock {
}
pub fn phi_dsts(&self) -> Option<&OpPhiDsts> {
for instr in self.instrs.iter() {
match &instr.op {
Op::PhiDsts(phi) => return Some(phi),
_ => break,
}
if let Op::PhiDsts(phi) = &self.instrs.first()?.op {
return Some(phi);
}
None
}
#[allow(dead_code)]
pub fn phi_dsts_mut(&mut self) -> Option<&mut OpPhiDsts> {
for instr in self.instrs.iter_mut() {
match &mut instr.op {
Op::PhiDsts(phi) => return Some(phi),
_ => break,
}
if let Op::PhiDsts(phi) = &mut self.instrs.first_mut()?.op {
return Some(phi);
}
None
}