Merge pull request #584 from quake/quake/optimize-stmt-switch

fix: optimize_stmt should use fn `position`
This commit is contained in:
Stephen Chung 2022-07-20 18:08:37 +08:00 committed by GitHub
commit 87af0db074
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -745,7 +745,7 @@ fn optimize_stmt(stmt: &mut Stmt, state: &mut OptimizerState, preserve_result: b
// Remove all entries after a `true` condition
if let Some(n) = list
.iter()
.find(|&&index| match case_blocks[index].condition {
.position(|&index| match case_blocks[index].condition {
Expr::BoolConstant(true, ..) => true,
_ => false,
})