Skip to content

Commit 27edc2a

Browse files
committed
Auto merge of rust-lang#10531 - Nilstrieb:linklink, r=giraffate
Add explanation on how to run `cargo-clippy` and `clippy-driver` I don't know how this would be done on Windows or MacOS, feedback appreciated. I did find this snippet for MacOS but it seems a little sketchy. https://github.com/rust-lang/rust-clippy/blob/1d1e72308e5bcdf5abe95c1d29dfe82524940061/.github/workflows/clippy_bors.yml#L98-L102 changelog: none
2 parents f1b9105 + b782a07 commit 27edc2a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

book/src/development/adding_lints.md

+10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ because that's clearly a non-descriptive name.
1818
- [Cargo lints](#cargo-lints)
1919
- [Rustfix tests](#rustfix-tests)
2020
- [Testing manually](#testing-manually)
21+
- [Running directly](#running-directly)
2122
- [Lint declaration](#lint-declaration)
2223
- [Lint registration](#lint-registration)
2324
- [Lint passes](#lint-passes)
@@ -186,6 +187,15 @@ cargo dev lint input.rs
186187
from the working copy root. With tests in place, let's have a look at
187188
implementing our lint now.
188189

190+
## Running directly
191+
192+
While it's easier to just use `cargo dev lint`, it might be desirable to get
193+
`target/release/cargo-clippy` and `target/release/clippy-driver` to work as well in some cases.
194+
By default, they don't work because clippy dynamically links rustc. To help them find rustc,
195+
add the path printed by`rustc --print target-libdir` (ran inside this workspace so that the rustc version matches)
196+
to your library search path.
197+
On linux, this can be done by setting the `LD_LIBRARY_PATH` environment variable to that path.
198+
189199
## Lint declaration
190200

191201
Let's start by opening the new file created in the `clippy_lints` crate at

0 commit comments

Comments
 (0)