@@ -440,11 +440,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
440
440
debug ! ( ?r) ;
441
441
if !indices. indices . contains_key ( & r) {
442
442
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 ( ) ;
448
444
self . infcx . next_nll_region_var ( FR , || {
449
445
RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
450
446
} )
@@ -478,11 +474,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
478
474
debug ! ( ?r) ;
479
475
if !indices. indices . contains_key ( & r) {
480
476
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 ( ) ;
486
478
self . infcx . next_nll_region_var ( FR , || {
487
479
RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
488
480
} )
@@ -768,15 +760,10 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
768
760
T : TypeFoldable < TyCtxt < ' tcx > > ,
769
761
{
770
762
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 ( ) ;
775
764
debug ! ( ?region, ?name) ;
776
765
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) )
780
767
} )
781
768
}
782
769
@@ -829,11 +816,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
829
816
debug ! ( ?r) ;
830
817
if !indices. indices . contains_key ( & r) {
831
818
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 ( ) ;
837
820
self . next_nll_region_var ( FR , || {
838
821
RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
839
822
} )
@@ -855,11 +838,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
855
838
debug ! ( ?r) ;
856
839
if !indices. indices . contains_key ( & r) {
857
840
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 ( ) ;
863
842
self . next_nll_region_var ( FR , || {
864
843
RegionCtxt :: LateBound ( BoundRegionInfo :: Name ( name) )
865
844
} )
0 commit comments