Encourage using LateLintPass

This commit is contained in:
Aneesh Kadiyala 2024-03-30 11:11:16 +05:30
parent 971e4355b9
commit e2861d5652

View File

@ -297,10 +297,10 @@ 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 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]. either [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass].
In short, the `LateLintPass` has access to type information while the In short, the `EarlyLintPass` runs before type checking and
`EarlyLintPass` doesn't. If you don't need access to type information, use the [HIR](https://rustc-dev-guide.rust-lang.org/hir.html) lowering and the `LateLintPass`
`EarlyLintPass`. The `EarlyLintPass` is also faster. However, linting speed has access to type information. Consider using the `LateLintPass` unless you need
hasn't really been a concern with Clippy so far. something specific from the `EarlyLintPass`.
Since we don't need type information for checking the function name, we used 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 `--pass=early` when running the new lint automation and all the imports were