File tree 2 files changed +18
-2
lines changed
2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ fn exit_if_err(status: io::Result<ExitStatus>) {
13
13
}
14
14
}
15
15
16
- pub fn run ( path : & str ) {
16
+ pub fn run < ' a > ( path : & str , args : impl Iterator < Item = & ' a str > ) {
17
17
let is_file = match fs:: metadata ( path) {
18
18
Ok ( metadata) => metadata. is_file ( ) ,
19
19
Err ( e) => {
@@ -30,6 +30,7 @@ pub fn run(path: &str) {
30
30
. args ( [ "-Z" , "no-codegen" ] )
31
31
. args ( [ "--edition" , "2021" ] )
32
32
. arg ( path)
33
+ . args ( args)
33
34
. status ( ) ,
34
35
) ;
35
36
} else {
@@ -42,6 +43,8 @@ pub fn run(path: &str) {
42
43
. expect ( "failed to create tempdir" ) ;
43
44
44
45
let status = Command :: new ( cargo_clippy_path ( ) )
46
+ . arg ( "clippy" )
47
+ . args ( args)
45
48
. current_dir ( path)
46
49
. env ( "CARGO_TARGET_DIR" , target. as_ref ( ) )
47
50
. status ( ) ;
Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ fn main() {
76
76
} ,
77
77
( "lint" , Some ( matches) ) => {
78
78
let path = matches. value_of ( "path" ) . unwrap ( ) ;
79
- lint:: run ( path) ;
79
+ let args = matches. values_of ( "args" ) . into_iter ( ) . flatten ( ) ;
80
+ lint:: run ( path, args) ;
80
81
} ,
81
82
( "rename_lint" , Some ( matches) ) => {
82
83
let old_name = matches. value_of ( "old_name" ) . unwrap ( ) ;
@@ -278,11 +279,23 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
278
279
Lint a package directory:
279
280
cargo dev lint tests/ui-cargo/wildcard_dependencies/fail
280
281
cargo dev lint ~/my-project
282
+
283
+ Run rustfix:
284
+ cargo dev lint ~/my-project -- --fix
285
+
286
+ Set lint levels:
287
+ cargo dev lint file.rs -- -W clippy::pedantic
288
+ cargo dev lint ~/my-project -- -- -W clippy::pedantic
281
289
" } )
282
290
. arg (
283
291
Arg :: with_name ( "path" )
284
292
. required ( true )
285
293
. help ( "The path to a file or package directory to lint" ) ,
294
+ )
295
+ . arg (
296
+ Arg :: with_name ( "args" )
297
+ . multiple ( true )
298
+ . help ( "Pass extra arguments to cargo/clippy-driver" ) ,
286
299
) ,
287
300
)
288
301
. subcommand (
You can’t perform that action at this time.
0 commit comments