Skip to content

Commit

Permalink
Remove an unnecessary if let.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Feb 23, 2024
1 parent 109321a commit 938e594
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions compiler/rustc_hir_typeck/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// While we don't allow *arbitrary* coercions here, we *do* allow
// coercions from ! to `expected`.
if ty.is_never() {
if let Some(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
if let Some(_) = self.typeck_results.borrow().adjustments().get(expr.hir_id) {
let reported = self.dcx().span_delayed_bug(
expr.span,
"expression with never type wound up being adjusted",
);
return if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] {
target.to_owned()
} else {
Ty::new_error(self.tcx(), reported)
};
return Ty::new_error(self.tcx(), reported);
}

let adj_ty = self.next_ty_var(TypeVariableOrigin {
Expand Down

0 comments on commit 938e594

Please sign in to comment.