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

Extract commonly used visitors to utils #4413

Open
flip1995 opened this issue Aug 19, 2019 · 3 comments
Open

Extract commonly used visitors to utils #4413

flip1995 opened this issue Aug 19, 2019 · 3 comments
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy

Comments

@flip1995
Copy link
Member

Both #3427 and #4386 implement a Visitor that walks an expression and searches for a return. This should be de-duplicated.

Maybe there are other Visitors in the Clippy code base, that also do similar things and can be extracted to utils.

Originally posted by @mikerite in #4386 (comment)

@flip1995 flip1995 added good-first-issue These issues are a good way to get started with Clippy C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages labels Aug 19, 2019
@phansch
Copy link
Member

phansch commented Aug 19, 2019

I don't really have any experience working with visitors, so I'd like to pick this up ✋

@phansch phansch self-assigned this Aug 19, 2019
@phansch
Copy link
Member

phansch commented Aug 20, 2019

One problem I see is that one visitor works on ast::Expr to check for ast::ExprKind::Try but the second visitor is used in a LateContext which doesn't have access to the AST types anymore and can't check for Try. That would make it impossible to combine these two, no?

@flip1995
Copy link
Member Author

Jop, that makes this impossible. Maybe the LatePass lint can be moved to an EarlyPass?

@phansch phansch removed their assignment Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

No branches or pull requests

3 participants