Address Clippy lints
This commit is contained in:
parent
b1d49624d4
commit
8ed5e410ff
6 changed files with 109 additions and 102 deletions
|
@ -23,10 +23,8 @@ impl IndexedQueue {
|
|||
#[pyo3(signature = (items=None))]
|
||||
fn new(items: Option<Py<PyAny>>) -> PyResult<Self> {
|
||||
if let Some(py_object) = items {
|
||||
Python::with_gil(|py| Self::from_any(py_object.bind(py))).and_then(|vec| {
|
||||
Ok(Self {
|
||||
backing: Box::new(IndexedBinaryHeap::from_iter(vec)),
|
||||
})
|
||||
Python::with_gil(|py| Self::from_any(py_object.bind(py))).map(|vec| Self {
|
||||
backing: Box::new(IndexedBinaryHeap::from_iter(vec)),
|
||||
})
|
||||
} else {
|
||||
Ok(Self {
|
||||
|
@ -88,20 +86,18 @@ impl<'py> IndexedQueue {
|
|||
fn from_any(object: &Bound<'py, PyAny>) -> PyResult<Vec<(PyItem, f64)>> {
|
||||
if let Ok(vec) = object.extract::<Vec<(Py<PyAny>, f64)>>() {
|
||||
Ok(Self::from_vec(vec))
|
||||
} else {
|
||||
if object.is_instance_of::<PyDict>() {
|
||||
if let Ok(dict) = object.downcast::<PyDict>() {
|
||||
Self::from_dict(dict)
|
||||
} else {
|
||||
Err(PyErr::new::<PyTypeError, _>(
|
||||
"Argument claimed to be a dict but wasn't",
|
||||
))
|
||||
}
|
||||
} else if object.is_instance_of::<PyDict>() {
|
||||
if let Ok(dict) = object.downcast::<PyDict>() {
|
||||
Self::from_dict(dict)
|
||||
} else {
|
||||
Err(PyErr::new::<PyTypeError, _>(
|
||||
"Argument was not a properly-formed dict, list, or tuple",
|
||||
"Argument claimed to be a dict but wasn't",
|
||||
))
|
||||
}
|
||||
} else {
|
||||
Err(PyErr::new::<PyTypeError, _>(
|
||||
"Argument was not a properly-formed dict, list, or tuple",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue