@@ -58,37 +58,33 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
5858 let fn_decl = hir. fn_decl_by_hir_id ( owner_id) . unwrap ( ) ;
5959 let poly_fn_sig = self . tcx ( ) . fn_sig ( id) ;
6060 let fn_sig = self . tcx ( ) . liberate_late_bound_regions ( id, & poly_fn_sig) ;
61- body. params
62- . iter ( )
63- . enumerate ( )
64- . filter_map ( |( index, param) | {
65- // May return None; sometimes the tables are not yet populated.
66- let ty = fn_sig. inputs ( ) [ index] ;
67- let mut found_anon_region = false ;
68- let new_param_ty = self . tcx ( ) . fold_regions ( & ty, & mut false , |r, _| {
69- if * r == * anon_region {
70- found_anon_region = true ;
71- replace_region
72- } else {
73- r
74- }
75- } ) ;
76- if found_anon_region {
77- let ty_hir_id = fn_decl. inputs [ index] . hir_id ;
78- let param_ty_span = hir. span ( ty_hir_id) ;
79- let is_first = index == 0 ;
80- Some ( AnonymousParamInfo {
81- param,
82- param_ty : new_param_ty,
83- param_ty_span,
84- bound_region,
85- is_first,
86- } )
61+ body. params . iter ( ) . enumerate ( ) . find_map ( |( index, param) | {
62+ // May return None; sometimes the tables are not yet populated.
63+ let ty = fn_sig. inputs ( ) [ index] ;
64+ let mut found_anon_region = false ;
65+ let new_param_ty = self . tcx ( ) . fold_regions ( & ty, & mut false , |r, _| {
66+ if * r == * anon_region {
67+ found_anon_region = true ;
68+ replace_region
8769 } else {
88- None
70+ r
8971 }
90- } )
91- . next ( )
72+ } ) ;
73+ if found_anon_region {
74+ let ty_hir_id = fn_decl. inputs [ index] . hir_id ;
75+ let param_ty_span = hir. span ( ty_hir_id) ;
76+ let is_first = index == 0 ;
77+ Some ( AnonymousParamInfo {
78+ param,
79+ param_ty : new_param_ty,
80+ param_ty_span,
81+ bound_region,
82+ is_first,
83+ } )
84+ } else {
85+ None
86+ }
87+ } )
9288 }
9389
9490 // Here, we check for the case where the anonymous region
0 commit comments