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

internal lint: forbid HashMap and HashSet and suggest the FxHash* variants #2853

Closed
oli-obk opened this issue Jun 19, 2018 · 4 comments
Closed
Labels
A-lint Area: New lints C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. E-help-wanted Call for participation: Help is requested to fix this issue. good-first-issue These issues are a good way to get started with Clippy L-perf Lint: Belongs in the perf lint group

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jun 19, 2018

They are much more performant and we don't need any collision prevention in clippy.

Once it works nicely we can upstream it to rustc, because they totally need that, too

@oli-obk oli-obk added good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. L-perf Lint: Belongs in the perf lint group E-help-wanted Call for participation: Help is requested to fix this issue. labels Jun 19, 2018
@dwijnand
Copy link
Member

dwijnand commented Jul 6, 2018

I might have a crack at this. Is there any prior art I can emulate for this? Are there any more mentoring instructions you could add to this, please? The more the merrier as I'm a Rust novice, and this is my first venture into the world of Clippy.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 6, 2018

The simplest solution (not quite correct, but I don't think we care) is to basically create a lint that only implements check_ident and if the argument is equal to HashMap or HashSet, we lint and suggest to use FxHashMap and FxHashSet.

Doing this by name obviously is not right, but anyone naming their things HashMap or HashSet should be angrily stared at anyway.

This lint is only for inside clippy and rustc, so the false positives aren't problematic

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 6, 2018

Basically this lint but with other names ;)

@mati865
Copy link
Contributor

mati865 commented Dec 29, 2018

It may become relic of the past when rust-lang/rust#56241 gets merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. E-help-wanted Call for participation: Help is requested to fix this issue. good-first-issue These issues are a good way to get started with Clippy L-perf Lint: Belongs in the perf lint group
Projects
None yet
Development

No branches or pull requests

3 participants