Skip to content

Commit

Permalink
Rollup merge of #81054 - LingMan:rem_as_ref, r=jyn514
Browse files Browse the repository at this point in the history
Drop a few unneeded borrows

`@rustbot` modify labels +C-cleanup +T-compiler
  • Loading branch information
GuillaumeGomez authored Jan 15, 2021
2 parents 1a194d9 + ba1f036 commit f8b1baa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,25 +813,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if ty.is_never() {
None
} else {
Some(match &elem.kind {
Some(match elem.kind {
// Point at the tail expression when possible.
hir::ExprKind::Block(block, _) => {
block.expr.as_ref().map_or(block.span, |e| e.span)
block.expr.map_or(block.span, |e| e.span)
}
_ => elem.span,
})
}
})
};

if let hir::ExprKind::If(_, _, Some(el)) = &expr.kind {
if let hir::ExprKind::If(_, _, Some(el)) = expr.kind {
if let Some(rslt) = check_in_progress(el) {
return rslt;
}
}

if let hir::ExprKind::Match(_, arms, _) = &expr.kind {
let mut iter = arms.iter().filter_map(|arm| check_in_progress(&arm.body));
if let hir::ExprKind::Match(_, arms, _) = expr.kind {
let mut iter = arms.iter().filter_map(|arm| check_in_progress(arm.body));
if let Some(span) = iter.next() {
if iter.next().is_none() {
return span;
Expand Down

0 comments on commit f8b1baa

Please sign in to comment.