Skip to content
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

extend lint interface with more _post methods #31512

Closed
llogiq opened this issue Feb 9, 2016 · 1 comment · Fixed by #31562
Closed

extend lint interface with more _post methods #31512

llogiq opened this issue Feb 9, 2016 · 1 comment · Fixed by #31562

Comments

@llogiq
Copy link
Contributor

llogiq commented Feb 9, 2016

For clippy's regex_macro lint, I made use of a Visitor so I could stop clippy from linting the same macro multiple times while being reasonably fast. However, this unfortunately means the lint ignores #[allow(_)] .. #[deny(_)] attributes below the crate level.

To solve this and other related problems, I propose any of

  • allow a lint to check anything from anywhere in the analysis by moving up the parent chain to check the level
  • allow a lint to opt out of check_* calls for the duration of a specific node including its child nodes
  • add after_* methods to the {Early, Late}LintPass trait, so lints can decide themselves

The third option is probably the easiest to implement, yet the most flexible. This would bring the trait closer to other stream parser implementations like SAX.

@llogiq llogiq changed the title extend lint interface extend lint interface with more _post methods Feb 10, 2016
@llogiq
Copy link
Contributor Author

llogiq commented Feb 10, 2016

Seeing that we already have a few, _post methods, I think adding some more will be an acceptable solution here. I'll have a PR shortly.

bors added a commit that referenced this issue Feb 13, 2016
This fixes #31512 for me.

A bit of explanation: I want to have `check_block_post(&mut self, &Context, &Block)` and `check_crate_post(&mut self, &Context, &Crate)` methods in both early and late lint passes. Ideally we'd have _post methods for all operations that walk, but this'll do for now.

@Manishearth r?
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant