File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -122,8 +122,8 @@ pub fn format(build: &Build, check: bool) {
122
122
WalkBuilder :: new ( src. clone ( ) ) . types ( matcher) . overrides ( ignore_fmt) . build_parallel ( ) ;
123
123
124
124
// there is a lot of blocking involved in spawning a child process and reading files to format.
125
- // spawn more processes than available cores to keep the CPU busy
126
- let max_processes = num_cpus :: get ( ) * 2 ;
125
+ // spawn more processes than available concurrency to keep the CPU busy
126
+ let max_processes = build . jobs ( ) as usize * 2 ;
127
127
128
128
// spawn child processes on a separate thread so we can batch entries we have received from ignore
129
129
let thread = std:: thread:: spawn ( move || {
@@ -135,7 +135,7 @@ pub fn format(build: &Build, check: bool) {
135
135
let child = rustfmt ( & src, & rustfmt_path, paths. as_slice ( ) , check) ;
136
136
children. push_back ( child) ;
137
137
138
- if children. len ( ) > max_processes {
138
+ if children. len ( ) >= max_processes {
139
139
// await oldest child
140
140
children. pop_front ( ) . unwrap ( ) ( ) ;
141
141
}
You can’t perform that action at this time.
0 commit comments