This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 11use clap:: Parser ;
2- use std:: path:: PathBuf ;
2+ use std:: { num :: NonZeroUsize , path:: PathBuf } ;
33
44#[ derive( Clone , Debug , Parser ) ]
55pub ( crate ) struct LintcheckConfig {
6- /// Number of threads to use, 0 automatic choice
7- #[ clap( long = "jobs" , short = 'j' , value_name = "N" , default_value_t = 1 ) ]
6+ /// Number of threads to use (default: all unless --fix or --recursive)
7+ #[ clap(
8+ long = "jobs" ,
9+ short = 'j' ,
10+ value_name = "N" ,
11+ default_value_t = 0 ,
12+ hide_default_value = true
13+ ) ]
814 pub max_jobs : usize ,
915 /// Set the path for a crates.toml where lintcheck should read the sources from
1016 #[ clap(
@@ -51,8 +57,11 @@ impl LintcheckConfig {
5157
5258 // look at the --threads arg, if 0 is passed, use the threads count
5359 if config. max_jobs == 0 {
54- // automatic choice
55- config. max_jobs = std:: thread:: available_parallelism ( ) . map_or ( 1 , |n| n. get ( ) ) ;
60+ config. max_jobs = if config. fix || config. recursive {
61+ 1
62+ } else {
63+ std:: thread:: available_parallelism ( ) . map_or ( 1 , NonZeroUsize :: get)
64+ } ;
5665 } ;
5766
5867 for lint_name in & mut config. lint_filter {
You can’t perform that action at this time.
0 commit comments