@@ -847,11 +847,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
847847
848848 let fn_returns = self . infcx . tcx . return_type_impl_or_dyn_traits ( suitable_region. scope ) ;
849849
850- let param = if let Some ( param) =
850+ let Some ( param) =
851851 find_param_with_region ( self . infcx . tcx , self . mir_def_id ( ) , f, outlived_f)
852- {
853- param
854- } else {
852+ else {
855853 return ;
856854 } ;
857855
@@ -930,37 +928,27 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
930928
931929 let tcx = self . infcx . tcx ;
932930
933- let instance = if let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category {
934- let ( fn_did, args) = match func_ty. kind ( ) {
935- ty:: FnDef ( fn_did, args) => ( fn_did, args) ,
936- _ => return ,
937- } ;
938- debug ! ( ?fn_did, ?args) ;
931+ let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category else { return } ;
932+ let ty:: FnDef ( fn_did, args) = func_ty. kind ( ) else { return } ;
933+ debug ! ( ?fn_did, ?args) ;
939934
940- // Only suggest this on function calls, not closures
941- let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
942- debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
943- if let ty:: Closure ( _, _) = ty. kind ( ) {
944- return ;
945- }
946-
947- if let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
948- tcx,
949- self . infcx . typing_env ( self . infcx . param_env ) ,
950- * fn_did,
951- self . infcx . resolve_vars_if_possible ( args) ,
952- ) {
953- instance
954- } else {
955- return ;
956- }
957- } else {
935+ // Only suggest this on function calls, not closures
936+ let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
937+ debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
938+ if let ty:: Closure ( _, _) = ty. kind ( ) {
939+ return ;
940+ }
941+ let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
942+ tcx,
943+ self . infcx . typing_env ( self . infcx . param_env ) ,
944+ * fn_did,
945+ self . infcx . resolve_vars_if_possible ( args) ,
946+ ) else {
958947 return ;
959948 } ;
960949
961- let param = match find_param_with_region ( tcx, self . mir_def_id ( ) , f, o) {
962- Some ( param) => param,
963- None => return ,
950+ let Some ( param) = find_param_with_region ( tcx, self . mir_def_id ( ) , f, o) else {
951+ return ;
964952 } ;
965953 debug ! ( ?param) ;
966954
0 commit comments