@@ -513,9 +513,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
513513 | ObligationCauseCode :: BuiltinDerivedObligation ( cause) => cause. parent_trait_pred ,
514514 _ => trait_pred,
515515 } ;
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 ;
519518 } ;
520519
521520 if let ty:: Ref ( region, base_ty, mutbl) = * real_ty. kind ( ) {
@@ -593,9 +592,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
593592 err : & mut DiagnosticBuilder < ' _ > ,
594593 trait_pred : ty:: PolyTraitPredicate < ' tcx > ,
595594 ) {
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 ;
599597 } ;
600598
601599 let ( def_id, output_ty, callable) = match * self_ty. kind ( ) {
@@ -607,9 +605,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
607605
608606 // `mk_trait_obligation_with_new_self_ty` only works for types with no escaping bound
609607 // 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 ;
613610 } ;
614611
615612 let new_obligation =
@@ -631,9 +628,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
631628 ..
632629 } ) ) => {
633630 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 ;
637633 } ;
638634 let args = decl. inputs . iter ( ) . map ( |_| "_" ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
639635 let sugg = format ! ( "({})" , args) ;
@@ -830,9 +826,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
830826 return ;
831827 }
832828
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 ;
836831 } ;
837832
838833 for refs_remaining in 0 ..refs_number {
@@ -1050,9 +1045,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
10501045 fn return_type_span ( & self , obligation : & PredicateObligation < ' tcx > ) -> Option < Span > {
10511046 let hir = self . tcx . hir ( ) ;
10521047 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 ;
10561050 } ;
10571051
10581052 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> {
15021496
15031497 // Only continue if a generator was found.
15041498 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 ;
15101501 } ;
15111502
15121503 let span = self . tcx . def_span ( generator_did) ;
0 commit comments