@@ -283,7 +283,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
283283 /// from at least one local module, and returns `true`. If the crate defining `def_id` is
284284 /// declared with an `extern crate`, the path is guaranteed to use the `extern crate`.
285285 fn try_print_visible_def_path ( & mut self , def_id : DefId ) -> Result < bool , PrintError > {
286- if NO_VISIBLE_PATH . with ( |flag| flag . get ( ) ) {
286+ if with_no_visible_paths ( ) {
287287 return Ok ( false ) ;
288288 }
289289
@@ -367,16 +367,16 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
367367
368368 /// Try to see if this path can be trimmed to a unique symbol name.
369369 fn try_print_trimmed_def_path ( & mut self , def_id : DefId ) -> Result < bool , PrintError > {
370- if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
370+ if with_forced_trimmed_paths ( ) {
371371 let trimmed = self . force_print_trimmed_def_path ( def_id) ?;
372372 if trimmed {
373373 return Ok ( true ) ;
374374 }
375375 }
376376 if !self . tcx ( ) . sess . opts . unstable_opts . trim_diagnostic_paths
377377 || matches ! ( self . tcx( ) . sess. opts. trimmed_def_paths, TrimmedDefPaths :: Never )
378- || NO_TRIMMED_PATH . with ( |flag| flag . get ( ) )
379- || SHOULD_PREFIX_WITH_CRATE . with ( |flag| flag . get ( ) )
378+ || with_no_trimmed_paths ( )
379+ || with_crate_prefix ( )
380380 {
381381 return Ok ( false ) ;
382382 }
@@ -861,7 +861,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
861861 p ! ( "@" , print_def_path( did. to_def_id( ) , args) ) ;
862862 } else {
863863 let span = self . tcx ( ) . def_span ( did) ;
864- let preference = if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
864+ let preference = if with_forced_trimmed_paths ( ) {
865865 FileNameDisplayPreference :: Short
866866 } else {
867867 FileNameDisplayPreference :: Remapped
@@ -1102,7 +1102,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
11021102 write ! ( self , "Sized" ) ?;
11031103 }
11041104
1105- if !FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
1105+ if !with_forced_trimmed_paths ( ) {
11061106 for re in lifetimes {
11071107 write ! ( self , " + " ) ?;
11081108 self . print_region ( re) ?;
@@ -1886,7 +1886,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
18861886 // available, and filename/line-number is mostly uninteresting.
18871887 let use_types = !def_id. is_local ( ) || {
18881888 // Otherwise, use filename/line-number if forced.
1889- let force_no_types = FORCE_IMPL_FILENAME_LINE . with ( |f| f . get ( ) ) ;
1889+ let force_no_types = with_forced_impl_filename_line ( ) ;
18901890 !force_no_types
18911891 } ;
18921892
@@ -1951,7 +1951,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
19511951 if cnum == LOCAL_CRATE {
19521952 if self . tcx . sess . at_least_rust_2018 ( ) {
19531953 // We add the `crate::` keyword on Rust 2018, only when desired.
1954- if SHOULD_PREFIX_WITH_CRATE . with ( |flag| flag . get ( ) ) {
1954+ if with_crate_prefix ( ) {
19551955 write ! ( self , "{}" , kw:: Crate ) ?;
19561956 self . empty_path = false ;
19571957 }
@@ -2154,7 +2154,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
21542154 return true ;
21552155 }
21562156
2157- if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
2157+ if with_forced_trimmed_paths ( ) {
21582158 return false ;
21592159 }
21602160
@@ -2437,7 +2437,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
24372437 } else {
24382438 let tcx = self . tcx ;
24392439
2440- let trim_path = FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) ;
2440+ let trim_path = with_forced_trimmed_paths ( ) ;
24412441 // Closure used in `RegionFolder` to create names for anonymous late-bound
24422442 // regions. We use two `DebruijnIndex`es (one for the currently folded
24432443 // late-bound region and the other for the binder level) to determine
0 commit comments