Merge commit 'ca3b393750' into clippy-subtree-update

This commit is contained in:
Philipp Krones 2024-04-18 17:48:52 +02:00
parent 876d5f00a0
commit a5aaf33422
84 changed files with 1067 additions and 427 deletions

View file

@ -18,7 +18,6 @@ because that's clearly a non-descriptive name.
- [Cargo lints](#cargo-lints)
- [Rustfix tests](#rustfix-tests)
- [Testing manually](#testing-manually)
- [Running directly](#running-directly)
- [Lint declaration](#lint-declaration)
- [Lint registration](#lint-registration)
- [Lint passes](#lint-passes)
@ -176,23 +175,26 @@ the tests.
Manually testing against an example file can be useful if you have added some
`println!`s and the test suite output becomes unreadable. To try Clippy with
your local modifications, run
your local modifications, run the following from the Clippy directory:
```
```bash
cargo dev lint input.rs
```
from the working copy root. With tests in place, let's have a look at
implementing our lint now.
To run Clippy on an existing project rather than a single file you can use
## Running directly
```bash
cargo dev lint /path/to/project
```
While it's easier to just use `cargo dev lint`, it might be desirable to get
`target/release/cargo-clippy` and `target/release/clippy-driver` to work as well in some cases.
By default, they don't work because clippy dynamically links rustc. To help them find rustc,
add the path printed by`rustc --print target-libdir` (ran inside this workspace so that the rustc version matches)
to your library search path.
On linux, this can be done by setting the `LD_LIBRARY_PATH` environment variable to that path.
Or set up a rustup toolchain that points to the local Clippy binaries
```bash
cargo dev setup toolchain
# Then in `/path/to/project` you can run
cargo +clippy clippy
```
## Lint declaration