lintcheck: don't run clippy in parallel by default

This commit is contained in:
Matthias Krüger 2021-02-27 01:34:45 +01:00
parent d931d1b5e6
commit 2d9932d720

View file

@ -588,7 +588,10 @@ pub fn run(clap_config: &ArgMatches) {
.flatten() .flatten()
.collect() .collect()
} else { } else {
let counter = std::sync::atomic::AtomicUsize::new(0); if config.max_jobs > 1 {
// run parallel with rayon
let counter = AtomicUsize::new(0);
// Ask rayon for thread count. Assume that half of that is the number of physical cores // Ask rayon for thread count. Assume that half of that is the number of physical cores
// Use one target dir for each core so that we can run N clippys in parallel. // Use one target dir for each core so that we can run N clippys in parallel.
@ -610,6 +613,16 @@ pub fn run(clap_config: &ArgMatches) {
.map(|krate| krate.run_clippy_lints(&cargo_clippy_path, &counter, num_cpus, num_crates)) .map(|krate| krate.run_clippy_lints(&cargo_clippy_path, &counter, num_cpus, num_crates))
.flatten() .flatten()
.collect() .collect()
} else {
// run sequential
let num_crates = crates.len();
crates
.into_iter()
.map(|krate| krate.download_and_extract())
.map(|krate| krate.run_clippy_lints(&cargo_clippy_path, &AtomicUsize::new(0), 1, num_crates))
.flatten()
.collect()
}
}; };
// generate some stats // generate some stats