Skip to content

Commit d7bbda5

Browse files
committed
README: Add subsection on running Clippy as a rustc wrapper
This is useful for projects that do not use cargo. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent a5c5c8f commit d7bbda5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@ If you want to run Clippy **only** on the given crate, use the `--no-deps` optio
9898
cargo clippy -p example -- --no-deps
9999
```
100100

101+
### As a rustc replacement (`clippy-driver`)
102+
103+
Clippy can also be used in projects that do not use cargo. To do so, you will need to replace
104+
your `rustc` compilation commands with `clippy-driver`. For example, if your project runs:
105+
106+
```terminal
107+
rustc --edition 2018 -Cpanic=abort foo.rs
108+
```
109+
110+
Then, to enable Clippy, you will need to call:
111+
112+
```terminal
113+
clippy-driver --edition 2018 -Cpanic=abort foo.rs
114+
```
115+
116+
Note that `rustc` will still run, i.e. it will still emit the output files it normally does.
117+
118+
You may notice that keeping `rustc` as the second argument (i.e. wrapping `rustc` by prepending
119+
`clippy-driver`) also works; however, the preferred way is to *not* wrap it.
120+
101121
### Travis CI
102122

103123
You can add Clippy to Travis CI in the same way you use it locally:

0 commit comments

Comments
 (0)