@@ -512,9 +512,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
512
512
| ObligationCauseCode :: BuiltinDerivedObligation ( cause) => cause. parent_trait_pred ,
513
513
_ => trait_pred,
514
514
} ;
515
- let real_ty = match real_trait_pred. self_ty ( ) . no_bound_vars ( ) {
516
- Some ( ty) => ty,
517
- None => return ,
515
+ let Some ( real_ty) = real_trait_pred. self_ty ( ) . no_bound_vars ( ) else {
516
+ return ;
518
517
} ;
519
518
520
519
if let ty:: Ref ( region, base_ty, mutbl) = * real_ty. kind ( ) {
@@ -586,9 +585,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
586
585
err : & mut Diagnostic ,
587
586
trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
588
587
) {
589
- let self_ty = match trait_pred. self_ty ( ) . no_bound_vars ( ) {
590
- None => return ,
591
- Some ( ty) => ty,
588
+ let Some ( self_ty) = trait_pred. self_ty ( ) . no_bound_vars ( ) else {
589
+ return ;
592
590
} ;
593
591
594
592
let ( def_id, output_ty, callable) = match * self_ty. kind ( ) {
@@ -600,9 +598,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
600
598
601
599
// `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
602
600
// variables, so bail out if we have any.
603
- let output_ty = match output_ty. no_bound_vars ( ) {
604
- Some ( ty) => ty,
605
- None => return ,
601
+ let Some ( output_ty) = output_ty. no_bound_vars ( ) else {
602
+ return ;
606
603
} ;
607
604
608
605
let new_obligation =
@@ -624,9 +621,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
624
621
..
625
622
} ) ) => {
626
623
err. span_label ( * span, "consider calling this closure" ) ;
627
- let name = match self . get_closure_name ( def_id, err, & msg) {
628
- Some ( name) => name,
629
- None => return ,
624
+ let Some ( name) = self . get_closure_name ( def_id, err, & msg) else {
625
+ return ;
630
626
} ;
631
627
let args = decl. inputs . iter ( ) . map ( |_| "_" ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
632
628
let sugg = format ! ( "({})" , args) ;
@@ -823,9 +819,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
823
819
return ;
824
820
}
825
821
826
- let mut suggested_ty = match trait_pred. self_ty ( ) . no_bound_vars ( ) {
827
- Some ( ty) => ty,
828
- None => return ,
822
+ let Some ( mut suggested_ty) = trait_pred. self_ty ( ) . no_bound_vars ( ) else {
823
+ return ;
829
824
} ;
830
825
831
826
for refs_remaining in 0 ..refs_number {
@@ -1039,9 +1034,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1039
1034
fn return_type_span ( & self , obligation : & PredicateObligation < ' tcx > ) -> Option < Span > {
1040
1035
let hir = self . tcx . hir ( ) ;
1041
1036
let parent_node = hir. get_parent_node ( obligation. cause . body_id ) ;
1042
- let sig = match hir. find ( parent_node) {
1043
- Some ( hir:: Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Fn ( sig, ..) , .. } ) ) => sig,
1044
- _ => return None ,
1037
+ let Some ( hir:: Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Fn ( sig, ..) , .. } ) ) = hir. find ( parent_node) else {
1038
+ return None ;
1045
1039
} ;
1046
1040
1047
1041
if let hir:: FnRetTy :: Return ( ret_ty) = sig. decl . output { Some ( ret_ty. span ) } else { None }
@@ -1491,11 +1485,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1491
1485
1492
1486
// Only continue if a generator was found.
1493
1487
debug ! ( ?generator, ?trait_ref, ?target_ty, "maybe_note_obligation_cause_for_async_await" ) ;
1494
- let ( generator_did, trait_ref, target_ty) = match ( generator, trait_ref, target_ty) {
1495
- ( Some ( generator_did) , Some ( trait_ref) , Some ( target_ty) ) => {
1496
- ( generator_did, trait_ref, target_ty)
1497
- }
1498
- _ => return false ,
1488
+ let ( Some ( generator_did) , Some ( trait_ref) , Some ( target_ty) ) = ( generator, trait_ref, target_ty) else {
1489
+ return false ;
1499
1490
} ;
1500
1491
1501
1492
let span = self . tcx . def_span ( generator_did) ;
0 commit comments