about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2024-04-14 18:06:59 +0000
committerWaffle Lapkin <waffle.lapkin@gmail.com>2024-05-02 03:47:32 +0200
commitff0bfea45f8e2f9f3081bd416b4610511b9a6384 (patch)
tree98ddb484c72261fe3c9ab5db1a3cd388a2472918
parentcfb2410752d7f7108f1b140a65310ffc9f6eb6c6 (diff)
downloadrust-ff0bfea45f8e2f9f3081bd416b4610511b9a6384.tar.gz
rust-ff0bfea45f8e2f9f3081bd416b4610511b9a6384.zip
Convert `if` to `match`
-rw-r--r--compiler/rustc_hir_typeck/src/fallback.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs
index c0b3984e3e1..3b00c7353e5 100644
--- a/compiler/rustc_hir_typeck/src/fallback.rs
+++ b/compiler/rustc_hir_typeck/src/fallback.rs
@@ -436,17 +436,12 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
                 //
                 // In practice currently the two ways that this happens is
                 // coercion and subtyping.
-                let (a, b) = if let ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) = atom {
-                    (a, b)
-                } else if let ty::PredicateKind::Subtype(ty::SubtypePredicate {
-                    a_is_expected: _,
-                    a,
-                    b,
-                }) = atom
-                {
-                    (a, b)
-                } else {
-                    return None;
+                let (a, b) = match atom {
+                    ty::PredicateKind::Coerce(ty::CoercePredicate { a, b }) => (a, b),
+                    ty::PredicateKind::Subtype(ty::SubtypePredicate { a_is_expected: _, a, b }) => {
+                        (a, b)
+                    }
+                    _ => return None,
                 };
 
                 let a_vid = self.root_vid(a)?;