Skip to content

Commit 323c283

Browse files
committed
Use if-let guard to avoid unwrapping
1 parent 737d473 commit 323c283

File tree

1 file changed

+3
-3
lines changed
  • compiler/rustc_hir_analysis/src/hir_ty_lowering

1 file changed

+3
-3
lines changed

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,9 +2575,9 @@ impl<'o, 'tcx> dyn HirTyLowerer<'tcx> + 'o {
25752575

25762576
pub fn lower_arg_ty(&self, ty: &hir::Ty<'tcx>, expected_ty: Option<Ty<'tcx>>) -> Ty<'tcx> {
25772577
match ty.kind {
2578-
hir::TyKind::Infer if expected_ty.is_some() => {
2579-
self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span);
2580-
expected_ty.unwrap()
2578+
hir::TyKind::Infer if let Some(expected_ty) = expected_ty => {
2579+
self.record_ty(ty.hir_id, expected_ty, ty.span);
2580+
expected_ty
25812581
}
25822582
_ => self.lower_ty(ty),
25832583
}

0 commit comments

Comments
 (0)