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

Lint impls within blocks not accompanied by the type definition. #2989

Closed
Manishearth opened this issue Aug 1, 2018 · 1 comment
Closed
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-style Lint: Belongs in the style lint group

Comments

@Manishearth
Copy link
Member

https://twitter.com/iximeow/status/1024681349288845318

Rust supports putting impls pretty much anywhere .

Putting both impls and structs inside a scope is pretty common, but it's less common to put just an impl inside a scope; it may mislead you into thinking the impl itself is scoped.

We should lint on cases where there's an impl within a block, where that impl is not accompanied by the corresponding struct.

Implementation wise the most efficient way to do this is likely to keep track of blocks and find impls within blocks, and then search the block contents for a type definition.

@Manishearth Manishearth added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. A-lint Area: New lints L-style Lint: Belongs in the style lint group labels Aug 1, 2018
@Havvy
Copy link

Havvy commented Aug 1, 2018

This is a duplicate of #2124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-style Lint: Belongs in the style lint group
Projects
None yet
Development

No branches or pull requests

2 participants