@@ -819,11 +819,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
819819
820820 let fn_returns = self . infcx . tcx . return_type_impl_or_dyn_traits ( suitable_region. scope ) ;
821821
822- let param = if let Some ( param) =
822+ let Some ( param) =
823823 find_param_with_region ( self . infcx . tcx , self . mir_def_id ( ) , f, outlived_f)
824- {
825- param
826- } else {
824+ else {
827825 return ;
828826 } ;
829827
@@ -902,31 +900,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
902900
903901 let tcx = self . infcx . tcx ;
904902
905- let instance = if let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category {
906- let ( fn_did, args) = match func_ty. kind ( ) {
907- ty:: FnDef ( fn_did, args) => ( fn_did, args) ,
908- _ => return ,
909- } ;
910- debug ! ( ?fn_did, ?args) ;
911-
912- // Only suggest this on function calls, not closures
913- let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
914- debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
915- if let ty:: Closure ( _, _) = ty. kind ( ) {
916- return ;
917- }
903+ let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category else { return } ;
904+ let ty:: FnDef ( fn_did, args) = func_ty. kind ( ) else { return } ;
905+ debug ! ( ?fn_did, ?args) ;
918906
919- if let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
920- tcx,
921- self . infcx . typing_env ( self . infcx . param_env ) ,
922- * fn_did,
923- self . infcx . resolve_vars_if_possible ( args) ,
924- ) {
925- instance
926- } else {
927- return ;
928- }
929- } else {
907+ // Only suggest this on function calls, not closures
908+ let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
909+ debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
910+ if let ty:: Closure ( _, _) = ty. kind ( ) {
911+ return ;
912+ }
913+ let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
914+ tcx,
915+ self . infcx . typing_env ( self . infcx . param_env ) ,
916+ * fn_did,
917+ self . infcx . resolve_vars_if_possible ( args) ,
918+ ) else {
930919 return ;
931920 } ;
932921
0 commit comments