mirror of https://github.com/Qiskit/qiskit.git
Use hashbrown::HashSet instead of ahash::HashSet (#12951)
In the `target_transpiler/mod.rs` module we were using ahash::HashSet for a hash set implementation, but the rest of Qiskit has standardized on using hashbrown for the `HashSet` and `HashMap` types. Hashbrown uses ahash for it's hashing algorithm but it also provides other advantages. To ensure that hash sets are compatible across the library we should be using the same library for everything. To support this goal, this commit also adds a clippy rule that raises a warning if the std library hashmap or hashset is used, or the versions from ahash. This means with our current dependency set the only allowed hashset types are `hashbrown::HashMap`/`HashSet` and `indexmap::IndexMap`/`IndexSet` (for where we need to maintain insertion order). Ideally we'd have a rule that forces the use of ahash with `IndexMap` and `IndexSet` (see #12935) but I don't think clippy exposes an option to enable something like that.
This commit is contained in:
parent
61adcf9d5f
commit
8e45a5aad1
|
@ -0,0 +1,6 @@
|
|||
disallowed-types = [
|
||||
"std::collections::HashSet",
|
||||
"std::collections::HashMap",
|
||||
"ahash::HashSet",
|
||||
"ahash::HashMap",
|
||||
]
|
|
@ -20,7 +20,7 @@ use std::ops::Index;
|
|||
|
||||
use ahash::RandomState;
|
||||
|
||||
use ahash::HashSet;
|
||||
use hashbrown::HashSet;
|
||||
use indexmap::{IndexMap, IndexSet};
|
||||
use itertools::Itertools;
|
||||
use nullable_index_map::NullableIndexMap;
|
||||
|
|
Loading…
Reference in New Issue