File tree 2 files changed +14
-2
lines changed 2 files changed +14
-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,19 @@ 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
281
285
" } )
282
286
. arg (
283
287
Arg :: with_name ( "path" )
284
288
. required ( true )
285
289
. help ( "The path to a file or package directory to lint" ) ,
290
+ )
291
+ . arg (
292
+ Arg :: with_name ( "args" )
293
+ . multiple ( true )
294
+ . help ( "Pass extra arguments to cargo/clippy-driver" ) ,
286
295
) ,
287
296
)
288
297
. subcommand (
You can’t perform that action at this time.
0 commit comments