Skip to content

Commit 0c60779

Browse files
committed
Avoid an intermediate Option and just create the resulting enum directly
1 parent 241fc13 commit 0c60779

File tree

1 file changed

+5
-9
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+5
-9
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -301,18 +301,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
301301
formal_input_ty,
302302
coerced_ty,
303303
);
304-
let subtyping_error = match supertype_error {
304+
305+
// If neither check failed, the types are compatible
306+
match supertype_error {
305307
Ok(InferOk { obligations, value: () }) => {
306308
self.register_predicates(obligations);
307-
None
309+
Compatibility::Compatible
308310
}
309-
Err(err) => Some(err),
310-
};
311-
312-
// If neither check failed, the types are compatible
313-
match subtyping_error {
314-
None => Compatibility::Compatible,
315-
Some(_) => Compatibility::Incompatible(subtyping_error),
311+
Err(err) => Compatibility::Incompatible(Some(err)),
316312
}
317313
};
318314

0 commit comments

Comments
 (0)