New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain how Clippy and lints work #2687
Conversation
Would be good if someone with more experience has a look at this, as I'm not sure if I used the correct terms everywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse); | ||
// ... | ||
|
||
reg.register_lint_group("clippy_restriction", vec![ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth mentioning that this code is autogenerated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I'm not sure I understand how that code would be autogenerated. It's a normal call to Registry.register_lint_group
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The util/update_lints.py
script looks through the sources and collects all lint definitions to generate this part of lib.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, that kind of autogenerated! I've always been modifying it manually until now.. Makes sense to add it
I added the note about the |
Also for #2666
This adds a rough overview of how Clippy hooks into rustc and how different lint types are registered with the PluginRegistry. It doesn't explain everything yet, but should give a good overview, hopefully.
It is partly inspired by the quick rustfmt tour.
Rendered