File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,13 @@ Now you can run Clippy by invoking the following command:
88
88
cargo clippy
89
89
```
90
90
91
+ You can also test or build your project with Clippy lints as add-on with this command:
92
+
93
+ ``` terminal
94
+ cargo clippy build
95
+ cargo clippy test
96
+ ```
97
+
91
98
#### Automatically applying Clippy suggestions
92
99
93
100
Clippy can automatically apply some lint suggestions, just like the compiler. Note that ` --fix ` implies
Original file line number Diff line number Diff line change @@ -16,3 +16,11 @@ your crate for maximum compatibility. E.g. if your crate is compiled with the
16
16
17
17
This chapter will give an overview on how to use Clippy on different popular CI
18
18
providers.
19
+
20
+ ## CI Time optimization
21
+
22
+ You can optimize time in your CI by running ` cargo clippy test ` , this will test your application at the same time as
23
+ it's linted. If Clippy doesn't report anything (or only has warnings), you will be saving precious CI time, as
24
+ there's no need to rebuild your application.
25
+
26
+ So, compilation time is halved compared to running ` cargo clippy ` and THEN ` cargo test ` .
Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ just run
16
16
cargo clippy
17
17
```
18
18
19
+ ## Running build/test at the same time as Clippy
20
+
21
+ You can also emit binaries and test your project with Clippy enabled! Reducing your compilation times as there's no
22
+ need to recompile.
23
+
24
+ ``` bash
25
+ cargo clippy test
26
+ cargo clippy build
27
+ ```
28
+
19
29
### Lint configuration
20
30
21
31
The above command will run the default set of lints, which are included in the
Original file line number Diff line number Diff line change @@ -77,10 +77,7 @@ impl ClippyCmd {
77
77
} ,
78
78
"--fix" => {
79
79
if cargo_subcommand != "check" {
80
- eprintln ! (
81
- "Running `cargo clippy {}` is not available with the --fix flag" ,
82
- cargo_subcommand
83
- ) ;
80
+ eprintln ! ( "Running `cargo clippy {cargo_subcommand}` is not available with the --fix flag" ) ;
84
81
process:: exit ( 1 ) // Same code as `--explain` encountering an unknown lint
85
82
}
86
83
cargo_subcommand = "fix" ;
You can’t perform that action at this time.
0 commit comments