@@ -46,27 +46,6 @@ impl App {
46
46
//
47
47
// The other operations which are invoked frequently should not utilize dynamic dispatch.
48
48
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
-
70
49
let column_width_distribution = self . args . column_width_distribution ( ) ;
71
50
72
51
if self . args . json_input {
@@ -115,6 +94,27 @@ impl App {
115
94
return Ok ( ( ) ) ;
116
95
}
117
96
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
+
118
118
let report_error = if self . args . silent_errors {
119
119
ErrorReport :: SILENT
120
120
} else {
0 commit comments