Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Lint request: warn when variable declared in match pattern shadows other variable #2890

Closed
PieterPenninckx opened this issue Jul 1, 2018 · 1 comment · Fixed by #7338
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 T-AST Type: Requires working with the AST

Comments

@PieterPenninckx
Copy link

"The Book" (TRPL) warns about variables declared in match patterns shadowing other variables. I have once been hit by this myself, so this seems to be a good idea for a lint.

@phansch phansch added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-AST Type: Requires working with the AST A-lint Area: New lints L-style Lint: Belongs in the style lint group labels Jul 11, 2018
bors added a commit that referenced this issue Sep 30, 2021
Re-write shadow lints

changelog: Move shadow_unrelated to restriction
changelog: The shadow lints find a lot more shadows and are not limited to certain patterns

Drastically simplifies the implementation. Catches a lot more cases.

I removed the "initialization happens here" note. It is not helpful IMO.

Closes #318
Fixes #2890
Fixes #6563
Fixes #7588
Fixes #7620
@bors bors closed this as completed in f8303ad Sep 30, 2021
@ojeda
Copy link
Contributor

ojeda commented Nov 23, 2024

This was closed because the existing shadow_* lints catch it, but those lints catch also other many cases at the same time. It would be nice to have a lint only for match. Please see #3433.

# for free to join this conversation on GitHub. Already have an account? # 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 T-AST Type: Requires working with the AST
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants