fix never_loop

This commit is contained in:
Cameron Steffen 2017-06-01 21:31:42 -05:00
parent a73edc0944
commit 4f374824b1

View File

@ -184,16 +184,15 @@ fn is_relevant_trait(tcx: ty::TyCtxt, item: &TraitItem) -> bool {
}
fn is_relevant_block(tcx: ty::TyCtxt, tables: &ty::TypeckTables, block: &Block) -> bool {
for stmt in &block.stmts {
if let Some(stmt) = block.stmts.first() {
match stmt.node {
StmtDecl(_, _) => return true,
StmtDecl(_, _) => true,
StmtExpr(ref expr, _) |
StmtSemi(ref expr, _) => {
return is_relevant_expr(tcx, tables, expr);
},
StmtSemi(ref expr, _) => is_relevant_expr(tcx, tables, expr),
}
} else {
block.expr.as_ref().map_or(false, |e| is_relevant_expr(tcx, tables, e))
}
block.expr.as_ref().map_or(false, |e| is_relevant_expr(tcx, tables, e))
}
fn is_relevant_expr(tcx: ty::TyCtxt, tables: &ty::TypeckTables, expr: &Expr) -> bool {