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

New lint: disallowed_types based on config #7277

Closed
DevinR528 opened this issue May 26, 2021 · 1 comment · Fixed by #7315
Closed

New lint: disallowed_types based on config #7277

DevinR528 opened this issue May 26, 2021 · 1 comment · Fixed by #7315
Labels
A-lint Area: New lints

Comments

@DevinR528
Copy link
Contributor

DevinR528 commented May 26, 2021

What it does

Check certain types are not used according to a config list (similar to disallowed_method).

Categories

  • Nursery

Allow a project to specify types that are not allowed.

Drawbacks

None 🤷

Example

use std::collections::HashMap;

Could be written as:
possibly with a short explanation that is included in the config somehow?

// Since non of the maps will be large the cost of hashing is greater than the cost of lookup.
use std::collections::BTreeMap;

If everyone is ok with this in the nursery I can open a PR.

@DevinR528 DevinR528 added the A-lint Area: New lints label May 26, 2021
@DevinR528 DevinR528 changed the title New lint: dissalow_types based on config New lint: disallowed_types based on config May 26, 2021
@jplatte
Copy link
Contributor

jplatte commented May 26, 2021

A great example for where one would want to disallow HashMap (and HashSet) specifically is proc-macros, since hash maps introduce non-determinism, which is bad for caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants