Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0db6411

Browse files
authored
fix(adding_lints): usage of early vs late lint pass (rust-lang#13955)
changelog: none This PR fixes explaining the difference in usage between early and late lint passes in the book.
2 parents dc99034 + 16ee014 commit 0db6411

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

book/src/development/adding_lints.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,11 @@ This is good, because it makes writing this particular lint less complicated.
299299
We have to make this decision with every new Clippy lint. It boils down to using
300300
either [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass].
301301

302-
In short, the `EarlyLintPass` runs before type checking and
303-
[HIR](https://rustc-dev-guide.rust-lang.org/hir.html) lowering and the `LateLintPass`
304-
has access to type information. Consider using the `LateLintPass` unless you need
305-
something specific from the `EarlyLintPass`.
302+
`EarlyLintPass` runs before type checking and
303+
[HIR](https://rustc-dev-guide.rust-lang.org/hir.html) lowering, while `LateLintPass`
304+
runs after these stages, providing access to type information. The `cargo dev new_lint` command
305+
defaults to the recommended `LateLintPass`, but you can specify `--pass=early` if your lint
306+
only needs AST level analysis.
306307

307308
Since we don't need type information for checking the function name, we used
308309
`--pass=early` when running the new lint automation and all the imports were

0 commit comments

Comments
 (0)