mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
nak: use filter() instead of open-coding it
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38807>
This commit is contained in:
parent
314144ba51
commit
28ff39fbb4
1 changed files with 2 additions and 18 deletions
|
|
@ -8918,15 +8918,7 @@ impl BasicBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn branch(&self) -> Option<&Instr> {
|
pub fn branch(&self) -> Option<&Instr> {
|
||||||
if let Some(i) = self.instrs.last() {
|
self.instrs.last().filter(|&i| i.is_branch())
|
||||||
if i.is_branch() {
|
|
||||||
Some(i)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn branch_ip(&self) -> Option<usize> {
|
pub fn branch_ip(&self) -> Option<usize> {
|
||||||
|
|
@ -8943,15 +8935,7 @@ impl BasicBlock {
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn branch_mut(&mut self) -> Option<&mut Instr> {
|
pub fn branch_mut(&mut self) -> Option<&mut Instr> {
|
||||||
if let Some(i) = self.instrs.last_mut() {
|
self.instrs.last_mut().filter(|i| i.is_branch())
|
||||||
if i.is_branch() {
|
|
||||||
Some(i)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn falls_through(&self) -> bool {
|
pub fn falls_through(&self) -> bool {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue