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

Why is unneeded_field_pattern enabled by default ? #4253

Closed
gnzlbg opened this issue Jul 4, 2019 · 2 comments
Closed

Why is unneeded_field_pattern enabled by default ? #4253

gnzlbg opened this issue Jul 4, 2019 · 2 comments

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 4, 2019

While it is sometimes clearer to use .., it is also often the case to want to make sure that a compilation-error will be produced if a pattern changes. Using .. silences these errors.

It is not clear to me that either direction is better than the other.

The docs (https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_field_pattern) do not mention a single case in which one might want to not use .., suggesting that the obvious choice is to always use it.

I think a middle ground could be to have two lints, one for types defined inside the crate, and one for types defined by extern crates. For extern crates, we should not suggest using ...

For types defined within the same crate, I still don't think that .. is always better than fully matching all fields. It depends on what you are trying to do.

@ghost
Copy link

ghost commented Jul 6, 2019

Previous discussion: #1741

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Jul 6, 2019

Duplicate.

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

No branches or pull requests

1 participant