File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1
1
use clap:: Parser ;
2
- use std:: path:: PathBuf ;
2
+ use std:: { num :: NonZeroUsize , path:: PathBuf } ;
3
3
4
4
#[ derive( Clone , Debug , Parser ) ]
5
5
pub ( 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
+ ) ]
8
14
pub max_jobs : usize ,
9
15
/// Set the path for a crates.toml where lintcheck should read the sources from
10
16
#[ clap(
@@ -51,8 +57,11 @@ impl LintcheckConfig {
51
57
52
58
// look at the --threads arg, if 0 is passed, use the threads count
53
59
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
+ } ;
56
65
} ;
57
66
58
67
for lint_name in & mut config. lint_filter {
You can’t perform that action at this time.
0 commit comments