@@ -440,11 +440,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
440440 debug ! ( ?r) ;
441441 if !indices. indices . contains_key ( & r) {
442442 let region_vid = {
443- let name = match r. get_name ( ) {
444- Some ( name) => name,
445- _ => Symbol :: intern ( "anon" ) ,
446- } ;
447-
443+ let name = r. get_name_or_anon ( ) ;
448444 self . infcx . next_nll_region_var ( FR , || {
449445 RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
450446 } )
@@ -478,11 +474,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
478474 debug ! ( ?r) ;
479475 if !indices. indices . contains_key ( & r) {
480476 let region_vid = {
481- let name = match r. get_name ( ) {
482- Some ( name) => name,
483- _ => Symbol :: intern ( "anon" ) ,
484- } ;
485-
477+ let name = r. get_name_or_anon ( ) ;
486478 self . infcx . next_nll_region_var ( FR , || {
487479 RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
488480 } )
@@ -768,15 +760,10 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
768760 T : TypeFoldable < TyCtxt < ' tcx > > ,
769761 {
770762 self . infcx . tcx . fold_regions ( value, |region, _depth| {
771- let name = match region. get_name ( ) {
772- Some ( name) => name,
773- _ => Symbol :: intern ( "anon" ) ,
774- } ;
763+ let name = region. get_name_or_anon ( ) ;
775764 debug ! ( ?region, ?name) ;
776765
777- let reg_var = self . next_nll_region_var ( origin, || RegionCtxt :: Free ( name) ) ;
778-
779- reg_var
766+ self . next_nll_region_var ( origin, || RegionCtxt :: Free ( name) )
780767 } )
781768 }
782769
@@ -829,11 +816,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
829816 debug ! ( ?r) ;
830817 if !indices. indices . contains_key ( & r) {
831818 let region_vid = {
832- let name = match r. get_name ( ) {
833- Some ( name) => name,
834- _ => Symbol :: intern ( "anon" ) ,
835- } ;
836-
819+ let name = r. get_name_or_anon ( ) ;
837820 self . next_nll_region_var ( FR , || {
838821 RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
839822 } )
@@ -855,11 +838,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
855838 debug ! ( ?r) ;
856839 if !indices. indices . contains_key ( & r) {
857840 let region_vid = {
858- let name = match r. get_name ( ) {
859- Some ( name) => name,
860- _ => Symbol :: intern ( "anon" ) ,
861- } ;
862-
841+ let name = r. get_name_or_anon ( ) ;
863842 self . next_nll_region_var ( FR , || {
864843 RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
865844 } )
0 commit comments