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 HashMap<T, ZST> where ZST is any zero sized type #1641

Closed
oli-obk opened this issue Mar 27, 2017 · 3 comments · Fixed by #6218
Closed

Lint HashMap<T, ZST> where ZST is any zero sized type #1641

oli-obk opened this issue Mar 27, 2017 · 3 comments · Fixed by #6218
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Mar 27, 2017

The user should be using HashSet<T> instead and magically create the ZSTs out of thin air when needed (since they are all the same value anyway).

@oli-obk oli-obk added L-unnecessary Lint: Warn about unnecessary code good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-middle Type: Probably requires verifiying types labels Mar 27, 2017
@clarfonthey
Copy link
Contributor

clarfonthey commented Apr 5, 2017

One exception I can think of for this: ZSTs not located in the same crate.

For example, if a dependency defines struct MyError(()) then this lint shouldn't trigger because the user can't necessarily create the value out of thin air, and it might not be a ZST in the future.

One example from libstd: https://doc.rust-lang.org/std/net/struct.AddrParseError.html

@korrat
Copy link
Contributor

korrat commented Oct 23, 2020

Hi, I would like to take a shot at this.

@ebroto
Copy link
Member

ebroto commented Oct 23, 2020

Hey @korrat, it's all yours!

If you have any question, don't hesitate to ask here, in Zulip, or open a draft PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-unnecessary Lint: Warn about unnecessary code T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants