@@ -513,9 +513,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
513
513
| ObligationCauseCode :: BuiltinDerivedObligation ( cause) => cause. parent_trait_pred ,
514
514
_ => trait_pred,
515
515
} ;
516
- let real_ty = match real_trait_pred. self_ty ( ) . no_bound_vars ( ) {
517
- Some ( ty) => ty,
518
- None => return ,
516
+ let Some ( real_ty) = real_trait_pred. self_ty ( ) . no_bound_vars ( ) else {
517
+ return ;
519
518
} ;
520
519
521
520
if let ty:: Ref ( region, base_ty, mutbl) = * real_ty. kind ( ) {
@@ -593,9 +592,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
593
592
err : & mut DiagnosticBuilder < ' _ > ,
594
593
trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
595
594
) {
596
- let self_ty = match trait_pred. self_ty ( ) . no_bound_vars ( ) {
597
- None => return ,
598
- Some ( ty) => ty,
595
+ let Some ( self_ty) = trait_pred. self_ty ( ) . no_bound_vars ( ) else {
596
+ return ;
599
597
} ;
600
598
601
599
let ( def_id, output_ty, callable) = match * self_ty. kind ( ) {
@@ -607,9 +605,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
607
605
608
606
// `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
609
607
// variables, so bail out if we have any.
610
- let output_ty = match output_ty. no_bound_vars ( ) {
611
- Some ( ty) => ty,
612
- None => return ,
608
+ let Some ( output_ty) = output_ty. no_bound_vars ( ) else {
609
+ return ;
613
610
} ;
614
611
615
612
let new_obligation =
@@ -631,9 +628,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
631
628
..
632
629
} ) ) => {
633
630
err. span_label ( * span, "consider calling this closure" ) ;
634
- let name = match self . get_closure_name ( def_id, err, & msg) {
635
- Some ( name) => name,
636
- None => return ,
631
+ let Some ( name) = self . get_closure_name ( def_id, err, & msg) else {
632
+ return ;
637
633
} ;
638
634
let args = decl. inputs . iter ( ) . map ( |_| "_" ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
639
635
let sugg = format ! ( "({})" , args) ;
@@ -830,9 +826,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
830
826
return ;
831
827
}
832
828
833
- let mut suggested_ty = match trait_pred. self_ty ( ) . no_bound_vars ( ) {
834
- Some ( ty) => ty,
835
- None => return ,
829
+ let Some ( mut suggested_ty) = trait_pred. self_ty ( ) . no_bound_vars ( ) else {
830
+ return ;
836
831
} ;
837
832
838
833
for refs_remaining in 0 ..refs_number {
@@ -1050,9 +1045,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1050
1045
fn return_type_span ( & self , obligation : & PredicateObligation < ' tcx > ) -> Option < Span > {
1051
1046
let hir = self . tcx . hir ( ) ;
1052
1047
let parent_node = hir. get_parent_node ( obligation. cause . body_id ) ;
1053
- let sig = match hir. find ( parent_node) {
1054
- Some ( hir:: Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Fn ( sig, ..) , .. } ) ) => sig,
1055
- _ => return None ,
1048
+ let Some ( hir:: Node :: Item ( hir:: Item { kind : hir:: ItemKind :: Fn ( sig, ..) , .. } ) ) = hir. find ( parent_node) else {
1049
+ return None ;
1056
1050
} ;
1057
1051
1058
1052
if let hir:: FnRetTy :: Return ( ret_ty) = sig. decl . output { Some ( ret_ty. span ) } else { None }
@@ -1502,11 +1496,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1502
1496
1503
1497
// Only continue if a generator was found.
1504
1498
debug ! ( ?generator, ?trait_ref, ?target_ty, "maybe_note_obligation_cause_for_async_await" ) ;
1505
- let ( generator_did, trait_ref, target_ty) = match ( generator, trait_ref, target_ty) {
1506
- ( Some ( generator_did) , Some ( trait_ref) , Some ( target_ty) ) => {
1507
- ( generator_did, trait_ref, target_ty)
1508
- }
1509
- _ => return false ,
1499
+ let ( Some ( generator_did) , Some ( trait_ref) , Some ( target_ty) ) = ( generator, trait_ref, target_ty) else {
1500
+ return false ;
1510
1501
} ;
1511
1502
1512
1503
let span = self . tcx . def_span ( generator_did) ;
0 commit comments