Skip to content

Commit 85959be

Browse files
committed
Auto merge of rust-lang#6193 - Ryan1729:add-more-LintStore-documentation, r=phansch
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. changelog: none
2 parents eaffd0e + 67bc11b commit 85959be

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/adding_lints.md

+11
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,17 @@ automate everything. We will have to register our lint pass manually in the
225225
store.register_early_pass(|| box foo_functions::FooFunctions);
226226
```
227227

228+
As one may expect, there is a corresponding `register_late_pass` method
229+
available as well. Without a call to one of `register_early_pass` or
230+
`register_late_pass`, the lint pass in question will not be run.
231+
232+
One reason that `cargo dev` does not automate this step is that multiple lints
233+
can use the same lint pass, so registering the lint pass may already be done
234+
when adding a new lint. Another reason that this step is not automated is that
235+
the order that the passes are registered determines the order the passes
236+
actually run, which in turn affects the order that any emitted lints are output
237+
in.
238+
228239
[declare_clippy_lint]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/lib.rs#L60
229240
[example_lint_page]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
230241
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

0 commit comments

Comments
 (0)