ci: fix beta clippy `map_clone` warning

This commit is contained in:
David Hewitt 2024-02-05 07:57:27 +00:00
parent 5dbb51b9ce
commit de93d15eeb
2 changed files with 5 additions and 2 deletions

View File

@ -1443,6 +1443,9 @@ where
{
/// Extracts `Self` from the source `PyObject`.
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
// TODO update MSRV past 1.59 and use .cloned() to make
// clippy happy
#[allow(clippy::map_clone)]
ob.downcast().map(Clone::clone).map_err(Into::into)
}
}

View File

@ -264,13 +264,13 @@ impl Sequence {
self.values.len()
}
fn __getitem__(&self, index: SequenceIndex<'_>) -> PyResult<PyObject> {
fn __getitem__(&self, index: SequenceIndex<'_>, py: Python<'_>) -> PyResult<PyObject> {
match index {
SequenceIndex::Integer(index) => {
let uindex = self.usize_index(index)?;
self.values
.get(uindex)
.map(Clone::clone)
.map(|o| o.clone_ref(py))
.ok_or_else(|| PyIndexError::new_err(index))
}
// Just to prove that slicing can be implemented