Use flatten instead of filter_map

This commit is contained in:
Yusuke Tanaka 2021-02-06 18:06:58 +09:00
parent a60c143fe0
commit fbe436b1d4
No known key found for this signature in database
GPG Key ID: 409D7EEE1E7A716A

View File

@ -739,7 +739,7 @@ fn combine_branches(b1: NeverLoopResult, b2: NeverLoopResult) -> NeverLoopResult
fn never_loop_block(block: &Block<'_>, main_loop_id: HirId) -> NeverLoopResult {
let stmts = block.stmts.iter().map(stmt_to_expr);
let expr = once(block.expr.as_deref());
let mut iter = stmts.chain(expr).filter_map(|e| e);
let mut iter = stmts.chain(expr).flatten();
never_loop_expr_seq(&mut iter, main_loop_id)
}