diff options
| author | Ryan Wiedemann <Ryan1729@gmail.com> | 2020-10-18 17:01:57 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-18 17:01:57 -0600 |
| commit | 67bc11bd0480b5657c8c8db233e55f9b16ed664a (patch) | |
| tree | f13c5a41b30f23cd78ef0d30f5f13ee6afb9405b | |
| parent | 01dd31fa60d2decef6322b94b65bd25a1194537e (diff) | |
| download | rust-67bc11bd0480b5657c8c8db233e55f9b16ed664a.tar.gz rust-67bc11bd0480b5657c8c8db233e55f9b16ed664a.zip | |
Add more infomation about LintStore registration
Backstory: I somehow missed the fact that I needed to register a lint pass in order for it to run, and I spent some time confused until I figured it out. So I wanted to make it clear that a missing `register_(early|late)_pass` call is a likely cause of a lint not running.
| -rw-r--r-- | doc/adding_lints.md | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/adding_lints.md b/doc/adding_lints.md index ab8ff711796..2572833b8de 100644 --- a/doc/adding_lints.md +++ b/doc/adding_lints.md @@ -225,6 +225,17 @@ automate everything. We will have to register our lint pass manually in the store.register_early_pass(|| box foo_functions::FooFunctions); ``` +As one may expect, there is a corresponding `register_late_pass` method +available as well. Without a call to one of `register_early_pass` or +`register_late_pass`, the lint pass in question will not be run. + +One reason that `cargo dev` does not automate this step is that multiple lints +can use the same lint pass, so registering the lint pass may already be done +when adding a new lint. Another reason that this step is not automated is that +the order that the passes are registered determines the order the passes +actually run, which in turn affects the order that any emitted lints are output +in. + [declare_clippy_lint]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/lib.rs#L60 [example_lint_page]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints |
