mirror of https://github.com/Qiskit/qiskit.git
Fix Rustfmt and clippy with latest rust stable (#12339)
* Fix Rustfmt and clippy with latest rust stable Running `cargo fmt` with a newer version of rust than what we use in CI (1.77.2 and 1.78.0 locally for me) is triggering the formatting updates in this commit. To ensure developers don't have to worry about commiting an accidental formatting change in their commits this commit proactively makes the change. Similarly the recent Rust 1.78 release included new clippy rules which are flagging some small issues that our MSRV of clippy doesn't have. This commit also fixes these as the suggestions are good and are compatible with our MSRV of 1.70. * Rename deprecated config file name * Remove dead code
This commit is contained in:
parent
2c418aa9b3
commit
c062dd6cf2
|
@ -141,7 +141,9 @@ impl ZXPaulis {
|
||||||
phases: &Bound<PyArray1<u8>>,
|
phases: &Bound<PyArray1<u8>>,
|
||||||
coeffs: &Bound<PyArray1<Complex64>>,
|
coeffs: &Bound<PyArray1<Complex64>>,
|
||||||
) -> PyResult<Self> {
|
) -> PyResult<Self> {
|
||||||
let &[num_ops, num_qubits] = x.shape() else { unreachable!("PyArray2 must be 2D") };
|
let &[num_ops, num_qubits] = x.shape() else {
|
||||||
|
unreachable!("PyArray2 must be 2D")
|
||||||
|
};
|
||||||
if z.shape() != [num_ops, num_qubits] {
|
if z.shape() != [num_ops, num_qubits] {
|
||||||
return Err(PyValueError::new_err(format!(
|
return Err(PyValueError::new_err(format!(
|
||||||
"'x' and 'z' have different shapes: {:?} and {:?}",
|
"'x' and 'z' have different shapes: {:?} and {:?}",
|
||||||
|
|
|
@ -324,7 +324,7 @@ impl CircuitData {
|
||||||
0,
|
0,
|
||||||
)?;
|
)?;
|
||||||
res.intern_context = self.intern_context.clone();
|
res.intern_context = self.intern_context.clone();
|
||||||
res.data = self.data.clone();
|
res.data.clone_from(&self.data);
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ use pyo3::types::{PyList, PyString, PyTuple, PyType};
|
||||||
use crate::error::QASM3ImporterError;
|
use crate::error::QASM3ImporterError;
|
||||||
|
|
||||||
pub trait PyRegister {
|
pub trait PyRegister {
|
||||||
fn bit(&self, py: Python, index: usize) -> PyResult<Py<PyAny>>;
|
|
||||||
// This really should be
|
// This really should be
|
||||||
// fn iter<'a>(&'a self, py: Python<'a>) -> impl Iterator<Item = &'a PyAny>;
|
// fn iter<'a>(&'a self, py: Python<'a>) -> impl Iterator<Item = &'a PyAny>;
|
||||||
// or at a minimum
|
// or at a minimum
|
||||||
|
@ -39,15 +38,6 @@ macro_rules! register_type {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PyRegister for $name {
|
impl PyRegister for $name {
|
||||||
/// Get an individual bit from the register.
|
|
||||||
fn bit(&self, py: Python, index: usize) -> PyResult<Py<PyAny>> {
|
|
||||||
// Unfortunately, `PyList::get_item_unchecked` isn't usable with the stable ABI.
|
|
||||||
self.items
|
|
||||||
.bind(py)
|
|
||||||
.get_item(index)
|
|
||||||
.map(|item| item.into_py(py))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bit_list<'a>(&'a self, py: Python<'a>) -> &Bound<'a, PyList> {
|
fn bit_list<'a>(&'a self, py: Python<'a>) -> &Bound<'a, PyList> {
|
||||||
self.items.bind(py)
|
self.items.bind(py)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue