Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ disallowed-types = [
"std::collections::HashMap",
"ahash::HashSet",
"ahash::HashMap",
"indexmap::IndexMap",
"indexmap::IndexSet",
]
33 changes: 18 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustworkx-core = "0.17"
fixedbitset = "0.5.7"
approx = "0.5"
itertools = "0.14.0"
ahash = "0.8.12"
foldhash = "0.2.0"
rayon = "1.12"
nom = "8.0"
nom-unicode = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion crates/bindgen-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ name = "qiskit-bindgen-c"
qiskit-bindgen.workspace = true
qiskit-cext-vtable = { workspace = true, features = ["python_binding"] }
anyhow.workspace = true
indexmap.workspace = true
qiskit-util.workspace = true
cbindgen.workspace = true
clap = { version = "4.6", features = ["derive"] }
2 changes: 1 addition & 1 deletion crates/bindgen-c/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

use indexmap::IndexMap;
use qiskit_cext_vtable::ExportedFunction;
use qiskit_util::IndexMap;

pub struct SlotsLists {
pub slots: IndexMap<String, SlotsList>,
Expand Down
8 changes: 4 additions & 4 deletions crates/bindgen-c/src/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
// that they have been altered from the originals.

use crate::SlotsLists;
use indexmap::IndexMap;
use qiskit_bindgen::fn_attrs;
use qiskit_util::IndexMap;
use std::fmt::Write;

/// Tracked failures from the linting of a resolved vtable listing against a set of extracted
Expand Down Expand Up @@ -68,8 +68,8 @@ pub fn lint(
bindings: &cbindgen::Bindings,
slots: &SlotsLists,
) -> anyhow::Result<Result<(), Failures>> {
let mut seen = IndexMap::<&str, (&str, usize)>::new();
let mut duplicates = IndexMap::<String, Vec<(String, usize)>>::new();
let mut seen = IndexMap::<&str, (&str, usize)>::default();
let mut duplicates = IndexMap::<String, Vec<(String, usize)>>::default();
for (api_name, list) in slots.slots.iter() {
for (slot, export) in list.iter_names() {
if let Some((prev_api, prev_slot)) = seen.insert(export, (api_name, slot)) {
Expand All @@ -82,7 +82,7 @@ pub fn lint(
}
}
}
let mut skipped_but_exported = IndexMap::new();
let mut skipped_but_exported = IndexMap::default();
let mut missing = Vec::new();
for func in bindings.functions.iter() {
let fname = func.path.name();
Expand Down
3 changes: 1 addition & 2 deletions crates/cext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ qiskit-circuit.workspace = true
qiskit-circuit-library.workspace = true
qiskit-transpiler.workspace = true
pyo3 = { workspace = true, optional = true }
indexmap.workspace = true
ahash.workspace = true
qiskit-util.workspace = true
smallvec.workspace = true
ndarray.workspace = true
nalgebra.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions crates/cext/src/transpiler/neighbors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ pub unsafe extern "C" fn qk_neighbors_clear(neighbors: *mut CNeighbors) {
mod test {
use super::*;

use indexmap::IndexMap;
use qiskit_circuit::PhysicalQubit;
use qiskit_circuit::operations::StandardGate;
use qiskit_transpiler::target::{Qargs, Target};
use qiskit_util::IndexMap;

// This is mostly for Miri.
#[test]
Expand All @@ -224,7 +224,7 @@ mod test {
None,
)
.unwrap();
let mut line: IndexMap<_, _, _> = Default::default();
let mut line: IndexMap<_, _> = Default::default();
for qubit in 0..num_qubits - 1 {
line.insert(Qargs::from([qubit, qubit + 1].map(PhysicalQubit)), None);
}
Expand Down Expand Up @@ -268,7 +268,7 @@ mod test {
None,
)
.unwrap();
let mut line: IndexMap<_, _, _> = Default::default();
let mut line: IndexMap<_, _> = Default::default();
line.insert(Qargs::Global, None);
target
.add_instruction(StandardGate::CZ.into(), None, None, Some(line))
Expand Down
14 changes: 7 additions & 7 deletions crates/cext/src/transpiler/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::sync::Arc;
use crate::dag::COperationKind;
use crate::exit_codes::{CInputError, ExitCode};
use crate::pointers::{check_ptr, const_ptr_as_ref, mut_ptr_as_ref};
use indexmap::IndexMap;
use qiskit_circuit::PhysicalQubit;
use qiskit_circuit::instruction::{Instruction, Parameters};
use qiskit_circuit::operations::StandardInstruction;
Expand All @@ -26,6 +25,7 @@ use qiskit_circuit::packed_instruction::PackedOperation;
use qiskit_circuit::parameter::parameter_expression::ParameterExpression;
use qiskit_circuit::parameter::symbol_expr::Symbol;
use qiskit_transpiler::target::{InstructionProperties, Qargs, Target, TargetOperation};
use qiskit_util::IndexMap;
use smallvec::{SmallVec, smallvec};

/// @ingroup QkTarget
Expand Down Expand Up @@ -497,7 +497,7 @@ impl From<StandardOperation> for PackedOperation {
pub struct TargetEntry {
operation: StandardOperation,
params: Option<SmallVec<[Param; 3]>>,
map: IndexMap<Qargs, Option<InstructionProperties>, ahash::RandomState>,
map: IndexMap<Qargs, Option<InstructionProperties>>,
name: Option<String>,
}

Expand Down Expand Up @@ -1009,8 +1009,8 @@ pub unsafe extern "C" fn qk_target_num_instructions(target: *const Target) -> us
/// qk_target_instruction_supported(target, "crx", (uint32_t []){0, 1}, params);
///
/// // Free the pointers
/// qk_param_free(params[0]);
/// qk_target_free(target);
/// qk_param_free(params[0]);
/// qk_target_free(target);
/// ```
///
/// # Safety
Expand Down Expand Up @@ -1220,8 +1220,8 @@ pub unsafe extern "C" fn qk_target_op_qargs_index(
/// Retrieve the qargs for the operation by index.
///
/// @param target A pointer to the ``QkTarget``.
/// @param op_idx The index at which the gate is stored.
/// @param qarg_idx The index at which the qargs are stored.
/// @param op_idx The index at which the gate is stored.
/// @param qarg_idx The index at which the qargs are stored.
/// @param qargs_out An out pointer to an array qubits. If ``op_idx`` refers to a a global
/// operation, a null pointer will be written. The written pointer is borrowed from the
/// target and must not be freed. A zero-qargs instruction will write out a non-null pointer,
Expand Down Expand Up @@ -1522,7 +1522,7 @@ pub unsafe extern "C" fn qk_target_op_get(
///
/// QkTargetOp op;
/// qk_target_op_get(target, 0, &op);
///
///
/// // Check if the operation is a gate;
/// if (op.op_type == QkOperationKind_Gate) {
/// QkGate gate = qk_target_op_gate(target, 0);
Expand Down
7 changes: 2 additions & 5 deletions crates/circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ workspace = true
qiskit-util = { workspace = true, features = ["py"] }
qiskit-quantum-info.workspace = true
rayon.workspace = true
ahash.workspace = true
foldhash.workspace = true
rustworkx-core.workspace = true
bytemuck = {workspace = true, features = ["derive"]}
bitfield-struct.workspace = true
Expand All @@ -32,6 +32,7 @@ nom-unicode.workspace = true
nom-language.workspace = true
crossterm = "0.29.0"
unicode-width = "0.2"
ahash = "0.8.12"
unicode-segmentation = "1.13"
lexical-core = "1.0.6"
lexical-write-float = "1.0.6"
Expand All @@ -52,10 +53,6 @@ features = ["rayon", "approx"]
workspace = true
features = ["rayon"]

[dependencies.indexmap]
workspace = true
features = ["rayon"]

[dependencies.smallvec]
workspace = true
features = ["union", "const_generics"]
Expand Down
4 changes: 2 additions & 2 deletions crates/circuit/src/bit_locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
use std::{fmt::Debug, hash::Hash, sync::OnceLock};

use crate::bit::{BitLocations, Register};
use indexmap::IndexMap;
use pyo3::prelude::*;
use pyo3::types::{IntoPyDict, PyDict};
use qiskit_util::IndexMap;

/// Structure that keeps a mapping of bits and their locations within
/// the circuit.
#[derive(Debug)]
pub struct BitLocator<B, R: Register> {
bit_locations: IndexMap<B, BitLocations<R>, ::ahash::RandomState>,
bit_locations: IndexMap<B, BitLocations<R>>,
cached: OnceLock<Py<PyDict>>,
}

Expand Down
8 changes: 4 additions & 4 deletions crates/circuit/src/circuit_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use pyo3::types::{IntoPyDict, PyDict, PyList, PySet, PyTuple, PyType};
use pyo3::{PyTraverseError, PyVisit, import_exception, intern};

use hashbrown::{HashMap, HashSet};
use indexmap::IndexMap;
use qiskit_util::IndexMap;
use smallvec::SmallVec;
use thiserror::Error;

Expand Down Expand Up @@ -1751,8 +1751,8 @@ impl CircuitData {
///
/// # Returns
/// An IndexMap containing the operation names as keys and their respective counts as values.
pub fn count_ops(&self) -> IndexMap<&str, usize, ::ahash::RandomState> {
let mut ops_count: IndexMap<&str, usize, ::ahash::RandomState> = IndexMap::default();
pub fn count_ops(&self) -> IndexMap<&str, usize> {
let mut ops_count: IndexMap<&str, usize> = IndexMap::default();
for instruction in &self.data {
*ops_count.entry(instruction.op.name()).or_insert(0) += 1;
}
Expand Down Expand Up @@ -2897,7 +2897,7 @@ impl PyCircuitData {
///
/// # Returns
/// An IndexMap containing the operation names as keys and their respective counts as values.
pub fn count_ops(&self) -> IndexMap<&str, usize, ::ahash::RandomState> {
pub fn count_ops(&self) -> IndexMap<&str, usize> {
self.inner.count_ops()
}

Expand Down
Loading
Loading