about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-03-22 20:13:57 +0100
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2023-03-24 16:26:22 +0000
commitb782a071ad06bbf52168c34f4c51912fd039d912 (patch)
treeeaac0716eca2b1ca422925e282ef6ce141892459
parente64c5961dc7640b4d5529608e0f321d586c027a0 (diff)
downloadrust-b782a071ad06bbf52168c34f4c51912fd039d912.tar.gz
rust-b782a071ad06bbf52168c34f4c51912fd039d912.zip
Add explanation on how to run `cargo-clippy` and `clippy-driver`
-rw-r--r--book/src/development/adding_lints.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/book/src/development/adding_lints.md b/book/src/development/adding_lints.md
index f57dc627dce..0f5ee7103de 100644
--- a/book/src/development/adding_lints.md
+++ b/book/src/development/adding_lints.md
@@ -18,6 +18,7 @@ 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)
@@ -186,6 +187,15 @@ cargo dev lint input.rs
 from the working copy root. With tests in place, let's have a look at
 implementing our lint now.
 
+## Running directly
+
+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.
+
 ## Lint declaration
 
 Let's start by opening the new file created in the `clippy_lints` crate at