about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2025-01-13 13:21:00 +0000
committerGitHub <noreply@github.com>2025-01-13 13:21:00 +0000
commit0db64118ca92701e72c15c76d1157329cd2dd120 (patch)
tree3e5601b0bae5828e2841f25774ae45002ca5d35d
parentdc99034fd4b81f8e53c0285a586c06e351380fc2 (diff)
parent16ee0148d417603135d0838521f4899ff441489e (diff)
downloadrust-0db64118ca92701e72c15c76d1157329cd2dd120.tar.gz
rust-0db64118ca92701e72c15c76d1157329cd2dd120.zip
fix(adding_lints): usage of early vs late lint pass (#13955)
changelog: none

This PR fixes explaining the difference in usage between early and late
lint passes in the book.
-rw-r--r--book/src/development/adding_lints.md9
1 files changed, 5 insertions, 4 deletions
diff --git a/book/src/development/adding_lints.md b/book/src/development/adding_lints.md
index c07568697d0..e502d525cf6 100644
--- a/book/src/development/adding_lints.md
+++ b/book/src/development/adding_lints.md
@@ -299,10 +299,11 @@ This is good, because it makes writing this particular lint less complicated.
 We have to make this decision with every new Clippy lint. It boils down to using
 either [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass].
 
-In short, the `EarlyLintPass` runs before type checking and
-[HIR](https://rustc-dev-guide.rust-lang.org/hir.html) lowering and the `LateLintPass`
-has access to type information. Consider using the `LateLintPass` unless you need
-something specific from the `EarlyLintPass`.
+`EarlyLintPass` runs before type checking and
+[HIR](https://rustc-dev-guide.rust-lang.org/hir.html) lowering, while `LateLintPass`
+runs after these stages, providing access to type information. The `cargo dev new_lint` command
+defaults to the recommended `LateLintPass`, but you can specify `--pass=early` if your lint
+only needs AST level analysis.
 
 Since we don't need type information for checking the function name, we used
 `--pass=early` when running the new lint automation and all the imports were