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

Merged
merged 2 commits into from Apr 25, 2018

Conversation

Projects
None yet
4 participants
@phansch
Collaborator

phansch commented Apr 21, 2018

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

@phansch

This comment has been minimized.

Collaborator

phansch commented Apr 21, 2018

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.

@Manishearth

Looks good to me

reg.register_early_lint_pass(box else_if_without_else::ElseIfWithoutElse);
// ...
reg.register_lint_group("clippy_restriction", vec![

This comment has been minimized.

@Manishearth

Manishearth Apr 21, 2018

Member

Worth mentioning that this code is autogenerated

This comment has been minimized.

@phansch

phansch Apr 22, 2018

Collaborator

Hm, I'm not sure I understand how that code would be autogenerated. It's a normal call to Registry.register_lint_group, no?

This comment has been minimized.

@llogiq

llogiq Apr 22, 2018

Collaborator

The util/update_lints.py script looks through the sources and collects all lint definitions to generate this part of lib.rs.

This comment has been minimized.

@phansch

phansch Apr 22, 2018

Collaborator

oh, that kind of autogenerated! I've always been modifying it manually until now.. Makes sense to add it 👍

@phansch

This comment has been minimized.

Collaborator

phansch commented Apr 24, 2018

I added the note about the update_lints.py script.

@oli-obk oli-obk merged commit 9a37566 into rust-lang:master Apr 25, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@phansch phansch deleted the phansch:explain_how_lints_work branch Apr 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment