@@ -46,27 +46,6 @@ impl App {
4646 //
4747 // The other operations which are invoked frequently should not utilize dynamic dispatch.
4848
49- let threads = match self . args . threads {
50- Threads :: Auto => {
51- let disks = Disks :: new_with_refreshed_list ( ) ;
52- if any_path_is_in_hdd :: < hdd:: RealApi > ( & self . args . files , & disks) {
53- eprintln ! ( "warning: HDD detected, the thread limit will be set to 1" ) ;
54- Some ( 1 )
55- } else {
56- None
57- }
58- }
59- Threads :: Max => None ,
60- Threads :: Fixed ( threads) => Some ( threads) ,
61- } ;
62-
63- if let Some ( threads) = threads {
64- rayon:: ThreadPoolBuilder :: new ( )
65- . num_threads ( threads)
66- . build_global ( )
67- . unwrap_or_else ( |_| eprintln ! ( "warning: Failed to set thread limit to {threads}" ) ) ;
68- }
69-
7049 let column_width_distribution = self . args . column_width_distribution ( ) ;
7150
7251 if self . args . json_input {
@@ -115,6 +94,27 @@ impl App {
11594 return Ok ( ( ) ) ;
11695 }
11796
97+ let threads = match self . args . threads {
98+ Threads :: Auto => {
99+ let disks = Disks :: new_with_refreshed_list ( ) ;
100+ if any_path_is_in_hdd :: < hdd:: RealApi > ( & self . args . files , & disks) {
101+ eprintln ! ( "warning: HDD detected, the thread limit will be set to 1" ) ;
102+ Some ( 1 )
103+ } else {
104+ None
105+ }
106+ }
107+ Threads :: Max => None ,
108+ Threads :: Fixed ( threads) => Some ( threads) ,
109+ } ;
110+
111+ if let Some ( threads) = threads {
112+ rayon:: ThreadPoolBuilder :: new ( )
113+ . num_threads ( threads)
114+ . build_global ( )
115+ . unwrap_or_else ( |_| eprintln ! ( "warning: Failed to set thread limit to {threads}" ) ) ;
116+ }
117+
118118 let report_error = if self . args . silent_errors {
119119 ErrorReport :: SILENT
120120 } else {
0 commit comments