@@ -282,7 +282,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
282282 /// from at least one local module, and returns `true`. If the crate defining `def_id` is
283283 /// declared with an `extern crate`, the path is guaranteed to use the `extern crate`.
284284 fn try_print_visible_def_path ( & mut self , def_id : DefId ) -> Result < bool , PrintError > {
285- if NO_VISIBLE_PATH . with ( |flag| flag . get ( ) ) {
285+ if with_no_visible_paths ( ) {
286286 return Ok ( false ) ;
287287 }
288288
@@ -366,16 +366,16 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
366366
367367 /// Try to see if this path can be trimmed to a unique symbol name.
368368 fn try_print_trimmed_def_path ( & mut self , def_id : DefId ) -> Result < bool , PrintError > {
369- if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
369+ if with_forced_trimmed_paths ( ) {
370370 let trimmed = self . force_print_trimmed_def_path ( def_id) ?;
371371 if trimmed {
372372 return Ok ( true ) ;
373373 }
374374 }
375375 if !self . tcx ( ) . sess . opts . unstable_opts . trim_diagnostic_paths
376376 || matches ! ( self . tcx( ) . sess. opts. trimmed_def_paths, TrimmedDefPaths :: Never )
377- || NO_TRIMMED_PATH . with ( |flag| flag . get ( ) )
378- || SHOULD_PREFIX_WITH_CRATE . with ( |flag| flag . get ( ) )
377+ || with_no_trimmed_paths ( )
378+ || with_crate_prefix ( )
379379 {
380380 return Ok ( false ) ;
381381 }
@@ -860,7 +860,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
860860 p ! ( "@" , print_def_path( did. to_def_id( ) , args) ) ;
861861 } else {
862862 let span = self . tcx ( ) . def_span ( did) ;
863- let preference = if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
863+ let preference = if with_forced_trimmed_paths ( ) {
864864 FileNameDisplayPreference :: Short
865865 } else {
866866 FileNameDisplayPreference :: Remapped
@@ -1101,7 +1101,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
11011101 write ! ( self , "Sized" ) ?;
11021102 }
11031103
1104- if !FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
1104+ if !with_forced_trimmed_paths ( ) {
11051105 for re in lifetimes {
11061106 write ! ( self , " + " ) ?;
11071107 self . print_region ( re) ?;
@@ -1883,7 +1883,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
18831883 // available, and filename/line-number is mostly uninteresting.
18841884 let use_types = !def_id. is_local ( ) || {
18851885 // Otherwise, use filename/line-number if forced.
1886- let force_no_types = FORCE_IMPL_FILENAME_LINE . with ( |f| f . get ( ) ) ;
1886+ let force_no_types = with_forced_impl_filename_line ( ) ;
18871887 !force_no_types
18881888 } ;
18891889
@@ -1948,7 +1948,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
19481948 if cnum == LOCAL_CRATE {
19491949 if self . tcx . sess . at_least_rust_2018 ( ) {
19501950 // We add the `crate::` keyword on Rust 2018, only when desired.
1951- if SHOULD_PREFIX_WITH_CRATE . with ( |flag| flag . get ( ) ) {
1951+ if with_crate_prefix ( ) {
19521952 write ! ( self , "{}" , kw:: Crate ) ?;
19531953 self . empty_path = false ;
19541954 }
@@ -2151,7 +2151,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
21512151 return true ;
21522152 }
21532153
2154- if FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) {
2154+ if with_forced_trimmed_paths ( ) {
21552155 return false ;
21562156 }
21572157
@@ -2434,7 +2434,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
24342434 } else {
24352435 let tcx = self . tcx ;
24362436
2437- let trim_path = FORCE_TRIMMED_PATH . with ( |flag| flag . get ( ) ) ;
2437+ let trim_path = with_forced_trimmed_paths ( ) ;
24382438 // Closure used in `RegionFolder` to create names for anonymous late-bound
24392439 // regions. We use two `DebruijnIndex`es (one for the currently folded
24402440 // late-bound region and the other for the binder level) to determine
0 commit comments