@@ -830,11 +830,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
830830
831831 let fn_returns = self . infcx . tcx . return_type_impl_or_dyn_traits ( suitable_region. scope ) ;
832832
833- let param = if let Some ( param) =
833+ let Some ( param) =
834834 find_param_with_region ( self . infcx . tcx , self . mir_def_id ( ) , f, outlived_f)
835- {
836- param
837- } else {
835+ else {
838836 return ;
839837 } ;
840838
@@ -913,31 +911,22 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
913911
914912 let tcx = self . infcx . tcx ;
915913
916- let instance = if let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category {
917- let ( fn_did, args) = match func_ty. kind ( ) {
918- ty:: FnDef ( fn_did, args) => ( fn_did, args) ,
919- _ => return ,
920- } ;
921- debug ! ( ?fn_did, ?args) ;
922-
923- // Only suggest this on function calls, not closures
924- let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
925- debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
926- if let ty:: Closure ( _, _) = ty. kind ( ) {
927- return ;
928- }
914+ let ConstraintCategory :: CallArgument ( Some ( func_ty) ) = category else { return } ;
915+ let ty:: FnDef ( fn_did, args) = func_ty. kind ( ) else { return } ;
916+ debug ! ( ?fn_did, ?args) ;
929917
930- if let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
931- tcx,
932- self . infcx . typing_env ( self . infcx . param_env ) ,
933- * fn_did,
934- self . infcx . resolve_vars_if_possible ( args) ,
935- ) {
936- instance
937- } else {
938- return ;
939- }
940- } else {
918+ // Only suggest this on function calls, not closures
919+ let ty = tcx. type_of ( fn_did) . instantiate_identity ( ) ;
920+ debug ! ( "ty: {:?}, ty.kind: {:?}" , ty, ty. kind( ) ) ;
921+ if let ty:: Closure ( _, _) = ty. kind ( ) {
922+ return ;
923+ }
924+ let Ok ( Some ( instance) ) = ty:: Instance :: try_resolve (
925+ tcx,
926+ self . infcx . typing_env ( self . infcx . param_env ) ,
927+ * fn_did,
928+ self . infcx . resolve_vars_if_possible ( args) ,
929+ ) else {
941930 return ;
942931 } ;
943932
0 commit comments